!21 同步openEuler-22.03-LTS-SP1

From: @renoseven 
Reviewed-by: @snoweay 
Signed-off-by: @snoweay
This commit is contained in:
openeuler-ci-bot 2023-03-15 10:00:24 +00:00 committed by Gitee
commit 98363b108a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 95 additions and 31 deletions

View File

@ -20,7 +20,11 @@ cd -
cp -r ${REPO} ${REPO}-${VERSION} cp -r ${REPO} ${REPO}-${VERSION}
cd ${REPO}-${VERSION} cd ${REPO}-${VERSION}
git checkout ${VERSION} if [ "${VERSION}" != "HEAD" ]; then
git checkout v${VERSION}
else
git checkout ${VERSION}
fi
for file in `find . -name Cargo.toml` for file in `find . -name Cargo.toml`
do do

Binary file not shown.

BIN
syscare-1.0.1.tar.gz Normal file

Binary file not shown.

View File

@ -1,69 +1,129 @@
%global debug_package %{nil} %global debug_package %{nil}
Name: syscare Name: syscare
Version: 0.1.1 Version: 1.0.1
Release: 1 Release: 1
Summary: system hot-fix service Summary: system hot-fix service
License: MulanPSL-2.0, GPL-2.0-only License: MulanPSL-2.0 and GPL-2.0-only
URL: https://gitee.com/openeuler/syscare URL: https://gitee.com/openeuler/syscare
Source0: %{name}-%{version}.tar.gz Source0: %{name}-%{version}.tar.gz
ExclusiveArch: x86_64
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: kpatch-runtime Requires: kpatch-runtime coreutils
%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.
%package build %package build
Summary: Tools for build syscare patch. Summary: Tools for build syscare patch.
Requires: %{name} = %{version}-%{release} Requires: %{name} = %{version}-%{release}
Requires: kpatch make gcc openssl-devel dwarves python3-devel bison flex Requires: kpatch make gcc openssl-devel dwarves python3-devel bison flex
Requires: rpm-build Requires: elfutils-libelf-devel
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
%build %build
cmake . mkdir -p build_tmp
cd build_tmp
cmake -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_VERSION=%{version}-%{release} -DKERNEL_VERSION=%{kernel_version} ..
make make
%install %install
cd build_tmp
%make_install %make_install
%ifarch x86_64
mkdir -p %{buildroot}/usr/lib/systemd/system mkdir -p %{buildroot}/lib/modules/%{kernel_version}/extra/syscare
install -m 0644 %{_builddir}/%{name}-%{version}/misc/%{name}-restore.service %{buildroot}/usr/lib/systemd/system install -m 0640 %{buildroot}/usr/libexec/syscare/upatch.ko %{buildroot}/lib/modules/%{kernel_version}/extra/syscare
install -m 0644 %{_builddir}/%{name}-%{version}/misc/%{name}-pre.service %{buildroot}/usr/lib/systemd/system cd %{buildroot}
find lib -name "upatch.ko" -fprintf %{_builddir}/%{name}-%{version}/ko.files.list "/%p\n"
%endif
%post %post
%systemd_post %{name}-restore.service mkdir -p /usr/lib/syscare/patches
%systemd_post %{name}-pre.service %ifarch x86_64
depmod -a > /dev/null 2>&1 || true
%systemd_post syscare-pre.service
%systemd_post syscare.service
systemctl enable syscare-pre.service
systemctl enable syscare.service
systemctl start syscare-pre
systemctl start syscare
%endif
%preun
rm -rf /usr/lib/syscare/patches
%ifarch x86_64
%systemd_preun syscare-pre.service
%systemd_preun syscare.service
%endif
%postun
%ifarch x86_64
depmod -a > /dev/null 2>&1 || true
%endif
%ifarch x86_64
%files -f ko.files.list
%endif
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%attr(755,root,root) /usr/bin/syscare %attr(755,root,root) /usr/bin/syscare
%attr(755,root,root) /usr/libexec/%{name}/upatch-tool %attr(644,root,root) /usr/lib/systemd/system/syscare-pre.service
%attr(755,root,root) /usr/libexec/%{name}/auto-recovery.sh %attr(644,root,root) /usr/lib/systemd/system/syscare.service
%attr(644,root,root) /usr/lib/systemd/system/%{name}-restore.service %ifarch x86_64
%attr(644,root,root) /usr/lib/systemd/system/%{name}-pre.service %dir /usr/libexec/syscare
%attr(640,root,root) /usr/libexec/syscare/upatch.ko
%attr(755,root,root) /usr/libexec/syscare/upatch-tool
%endif
%files build %files build
%defattr(-,root,root,-) %defattr(-,root,root,-)
%dir /usr/libexec/%{name} %dir /usr/libexec/syscare
%attr(755,root,root) /usr/libexec/%{name}/upatch-diff %attr(755,root,root) /usr/libexec/syscare/syscare-build
%attr(755,root,root) /usr/libexec/%{name}/upatch-build %attr(755,root,root) /usr/libexec/syscare/upatch-build
%attr(755,root,root) /usr/libexec/%{name}/syscare-build %ifarch x86_64
%attr(755,root,root) /usr/libexec/syscare/upatch-diff
%endif
%changelog %changelog
* Mon Nov 28 2022 snoweay<snoweay@163.com> - 0.1.1-1 * Wed Mar 15 2023 renoseven<dev@renoseven.net> - 1.0.1-1
- First version for test. Support patches restore, remove, insmod upatch.ko. - New syscare cli
* Mon Nov 21 2022 snoweay<snoweay@163.com> - 0.1.0-1 - Support building patch for C++ code
- init version for 0.1.1-1. - Support patch version verification
- Support elf name derivation
- Support fast reboot
* Wed Dec 21 2022 snoweay<snoweay@163.com> - 1.0.0-7
- Fix 42 relocation caused by gcc 11.
* Tue Dec 20 2022 snoweay<snoweay@163.com> - 1.0.0-6
- Fix patch open failure by reading patches at attach instead of load.
- Support epoch in spec.
* Sat Dec 17 2022 snoweay<snoweay@163.com> - 1.0.0-5
- Check version-release of source pkg & debuginfo pkg.
* Fri Dec 16 2022 snoweay<snoweay@163.com> - 1.0.0-4
- Avoid duplicate elfs by not following symlinks at build.
* Thu Dec 15 2022 snoweay<snoweay@163.com> - 1.0.0-3
- Change kernel patches' scontext before apply not at rpm-post.
* Wed Dec 14 2022 snoweay<snoweay@163.com> - 1.0.0-2
- Fix some issues:
- manager: Allow apply to actived kernel patch
- build: only 'NOT-APPLIED' patch package can be removed
- build: fix 'kernel patch cannot be insmod during system start' issue
- kmod: unregister when rmmod upatch
* Tue Dec 13 2022 snoweay<snoweay@163.com> - 1.0.0-1
- Release the first version 1.0.0.