update to 1.0.1-3

Signed-off-by: renoseven <dev@renoseven.net>
(cherry picked from commit cf91c7dad32e6261c3065875d58d7f5c72181f3f)
(cherry picked from commit af19c6367ed069a906d9c05c854747fb6f648a1c)
This commit is contained in:
renoseven 2023-03-29 18:42:15 +08:00 committed by openeuler-sync-bot
parent 16823de88e
commit b4f259cf4a
2 changed files with 53 additions and 30 deletions

Binary file not shown.

View File

@ -1,8 +1,12 @@
%global debug_package %{nil} %global debug_package %{nil}
%define kernel_devel_rpm %(echo $(rpm -q kernel-devel | head -n 1))
%define kernel_name %(echo $(rpm -q --qf "\%%{VERSION}-\%%{RELEASE}.\%%{ARCH}" %{kernel_devel_rpm}))
%define kernel_version %(echo $(rpm -q --qf "\%%{VERSION}-\%%{RELEASE}" %{kernel_devel_rpm}))
Name: syscare Name: syscare
Version: 1.0.1 Version: 1.0.1
Release: 2 Release: 3
Summary: system hot-fix service Summary: system hot-fix service
License: MulanPSL-2.0 and GPL-2.0-only License: MulanPSL-2.0 and GPL-2.0-only
@ -11,17 +15,33 @@ Source0: %{name}-%{version}.tar.gz
BuildRequires: rust cargo gcc gcc-g++ cmake make BuildRequires: rust cargo gcc gcc-g++ cmake make
BuildRequires: elfutils-libelf-devel BuildRequires: elfutils-libelf-devel
BuildRequires: kernel-devel
Requires: coreutils systemd kpatch-runtime Requires: coreutils systemd kpatch-runtime
%ifarch x86_64
Requires: %{name}-kmod >= 1.0.1-1
%endif
%description %description
SysCare is a system-level hot-fix software that provides single-machine-level and cluster-level security patches and system error hot-fixes for the operating system. SysCare is a system-level hot-fix software that provides single-machine-level and cluster-level security patches and system error hot-fixes for the operating system.
The host can fix the system problem without rebooting. The host can fix the system problem without rebooting.
%ifarch x86_64
%package kmod
Summary: Syscare kernel modules.
Requires: kernel = %{kernel_version}
BuildRequires: kernel-devel
BuildRequires: make gcc bison flex
%description kmod
Syscare kernel modules dependency.
%endif
%package build %package build
Summary: Tools for build syscare patch. Summary: Tools for build syscare patch.
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
%ifarch x86_64
Requires: %{name}-kmod >= 1.0.1-1
%endif
Requires: kpatch make gcc openssl-devel dwarves python3-devel bison flex Requires: kpatch make gcc openssl-devel dwarves python3-devel bison flex
Requires: elfutils-libelf-devel Requires: elfutils-libelf-devel
Requires: rpm-build Requires: rpm-build
@ -29,8 +49,6 @@ Requires: rpm-build
%description build %description build
Syscare build tools. Syscare build tools.
%define kernel_version $(rpm -q --qf "\%%{VERSION}-\%%{RELEASE}.\%%{ARCH}" `rpm -q kernel-devel` | head -n 1)
%prep %prep
%autosetup -p1 %autosetup -p1
@ -38,12 +56,16 @@ Syscare build tools.
mkdir -p build_tmp mkdir -p build_tmp
cd build_tmp cd build_tmp
cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_VERSION=%{version}-%{release} -DKERNEL_VERSION=%{kernel_version} .. cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_VERSION=%{version}-%{release} -DKERNEL_VERSION=%{kernel_name} ..
make make
%install %install
cd build_tmp cd build_tmp
%make_install %make_install
%ifarch x86_64
mkdir -p %{buildroot}/lib/modules/%{kernel_name}/extra/syscare
mv %{buildroot}/usr/libexec/syscare/upatch.ko %{buildroot}/lib/modules/%{kernel_name}/extra/syscare
%endif
%post %post
# Create runtime directory at installation # Create runtime directory at installation
@ -51,32 +73,14 @@ if [ "$1" -eq 1 ]; then
mkdir -p /usr/lib/syscare/patches mkdir -p /usr/lib/syscare/patches
fi fi
%ifarch x86_64
# Copy upatch kernel module to lib/modules
mkdir -p /lib/modules/$(uname -r)/extra/syscare
install -m 0644 /usr/libexec/syscare/upatch.ko /lib/modules/$(uname -r)/extra/syscare
# Generate kernel module list
depmod -a > /dev/null 2>&1 || true
# Start all services # Start all services
systemctl enable syscare-pre.service systemctl enable syscare
systemctl enable syscare.service
systemctl start syscare-pre
systemctl start syscare systemctl start syscare
%endif
%preun %preun
%ifarch x86_64
# Stop all services # Stop all services
systemctl stop syscare.service systemctl stop syscare
systemctl stop syscare-pre.service systemctl disable syscare
systemctl disable syscare.service
systemctl disable syscare-pre.service
# Unload upatch kernel module
rmmod upatch > /dev/null 2>&1 || true
%endif
%postun %postun
# Remove runtime directory at uninstallation # Remove runtime directory at uninstallation
@ -85,9 +89,20 @@ if [ "$1" -eq 0 ] || { [ -n "$2" ] && [ "$2" -eq 0 ]; }; then
fi fi
%ifarch x86_64 %ifarch x86_64
# Remove upatch kernel module from lib/modules %post kmod
rm -rf /lib/modules/$(uname -r)/extra/syscare # Generate kernel module list
depmod -a > /dev/null 2>&1 || true
# Start all services
systemctl enable syscare-upatch
systemctl start syscare-upatch
%preun kmod
# Stop all services
systemctl stop syscare-upatch
systemctl disable syscare-upatch
%postun kmod
# Generate kernel module list # Generate kernel module list
depmod -a > /dev/null 2>&1 || true depmod -a > /dev/null 2>&1 || true
%endif %endif
@ -95,14 +110,19 @@ depmod -a > /dev/null 2>&1 || true
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%attr(755,root,root) /usr/bin/syscare %attr(755,root,root) /usr/bin/syscare
%attr(644,root,root) /usr/lib/systemd/system/syscare-pre.service
%attr(644,root,root) /usr/lib/systemd/system/syscare.service %attr(644,root,root) /usr/lib/systemd/system/syscare.service
%ifarch x86_64 %ifarch x86_64
%dir /usr/libexec/syscare %dir /usr/libexec/syscare
%attr(640,root,root) /usr/libexec/syscare/upatch.ko
%attr(755,root,root) /usr/libexec/syscare/upatch-tool %attr(755,root,root) /usr/libexec/syscare/upatch-tool
%endif %endif
%ifarch x86_64
%files kmod
%dir /lib/modules/%{kernel_name}/extra/syscare
%attr(640,root,root) /lib/modules/%{kernel_name}/extra/syscare/upatch.ko
%attr(644,root,root) /usr/lib/systemd/system/syscare-upatch.service
%endif
%files build %files build
%defattr(-,root,root,-) %defattr(-,root,root,-)
%dir /usr/libexec/syscare %dir /usr/libexec/syscare
@ -113,6 +133,9 @@ depmod -a > /dev/null 2>&1 || true
%endif %endif
%changelog %changelog
* Thu Mar 30 2023 renoseven<dev@renoseven.net> - 1.0.1-3
- Fix upatch may not contain all symbols issue
- Add syscare-kmod package
* Wed Mar 29 2023 renoseven<dev@renoseven.net> - 1.0.1-2 * Wed Mar 29 2023 renoseven<dev@renoseven.net> - 1.0.1-2
- Fix rpm install & remove script issue - Fix rpm install & remove script issue
* Wed Mar 15 2023 renoseven<dev@renoseven.net> - 1.0.1-1 * Wed Mar 15 2023 renoseven<dev@renoseven.net> - 1.0.1-1