diff --git a/get-version.sh b/get-version.sh index 0cbf7163c8647c999c753ae4f7541be226dc2724..53572dd86eed7777ee8e7d239b4867f05f3c40fc 100755 --- a/get-version.sh +++ b/get-version.sh @@ -20,12 +20,25 @@ cd - cp -r ${REPO} ${REPO}-${VERSION} cd ${REPO}-${VERSION} +<<<<<<< HEAD git checkout ${VERSION} for file in `find . -name Cargo.toml` do dir=${file%/Cargo.toml*} +======= +if [ "${VERSION}" != "HEAD" ]; then + git checkout v${VERSION} +else + git checkout ${VERSION} +fi + +for file in `find . -name Cargo.toml` +do + dir=${file%/Cargo.toml*} + +>>>>>>> 59323fc (Release v1.0.0) if [ -n "${dir}" ]; then cd ${dir} cargo vendor diff --git a/syscare-0.1.1.tar.gz b/syscare-1.0.0.tar.gz similarity index 60% rename from syscare-0.1.1.tar.gz rename to syscare-1.0.0.tar.gz index 8216ce3221c5753005e5c7e11a107077cffa4589..0e5537ad2661e55eeeb244990919a3e5fae4eb37 100644 Binary files a/syscare-0.1.1.tar.gz and b/syscare-1.0.0.tar.gz differ diff --git a/syscare.spec b/syscare.spec index 02b3e4e673aefb0f5ea0278cc0894dc5f4228c35..fd9ec712928db653718a968570b65d1a61832eab 100644 --- a/syscare.spec +++ b/syscare.spec @@ -1,18 +1,17 @@ %global debug_package %{nil} Name: syscare -Version: 0.1.1 +Version: 1.0.0 Release: 1 Summary: system hot-fix service -License: MulanPSL-2.0, GPL-2.0-only +License: MulanPSL-2.0 GPL-2.0-only URL: https://gitee.com/openeuler/syscare Source0: %{name}-%{version}.tar.gz -ExclusiveArch: x86_64 - BuildRequires: rust cargo gcc gcc-g++ cmake make BuildRequires: elfutils-libelf-devel +BuildRequires: kernel-devel Requires: kpatch-runtime @@ -24,46 +23,88 @@ The host can fix the system problem without rebooting. Summary: Tools for build syscare patch. Requires: %{name} = %{version}-%{release} Requires: kpatch make gcc openssl-devel dwarves python3-devel bison flex +Requires: elfutils-libelf-devel Requires: rpm-build %description build Syscare build tools. +%define kernel_version $(rpm -q --qf "\%%{VERSION}-\%%{RELEASE}.\%%{ARCH}" `rpm -q kernel-devel` | head -n 1) + %prep %autosetup -p1 %build -cmake . +mkdir -p tmp_build +cd tmp_build +cmake -DSYSCARE_BUILD_VERSION=%{version} -DKERNEL_VERSION=%{kernel_version} .. make %install +cd tmp_build %make_install +mkdir -p %{buildroot}/lib/modules/%{kernel_version}/extra/syscare +%ifarch x86_64 +install -m 0640 %{buildroot}/usr/libexec/%{name}/upatch.ko %{buildroot}/lib/modules/%{kernel_version}/extra/syscare +%endif + mkdir -p %{buildroot}/usr/lib/systemd/system +%ifarch aarch64 +install -m 0644 %{_builddir}/%{name}-%{version}/misc/%{name}-restore-arm64.service %{buildroot}/usr/lib/systemd/system/%{name}-restore.service +%else install -m 0644 %{_builddir}/%{name}-%{version}/misc/%{name}-restore.service %{buildroot}/usr/lib/systemd/system install -m 0644 %{_builddir}/%{name}-%{version}/misc/%{name}-pre.service %{buildroot}/usr/lib/systemd/system +%endif + +mkdir -p %{buildroot}/usr/lib/syscare + +%ifarch x86_64 +cd %{buildroot} +find lib -name "upatch.ko" \ + -fprintf %{_builddir}/%{name}-%{version}/ko.files.list "/%p\n" +%endif %post %systemd_post %{name}-restore.service -%systemd_post %{name}-pre.service - +%ifarch x86_64 +%{_bindir}/systemctl enable %{name}-pre.service +%endif +depmod -a > /dev/null 2>&1 || true + +%preun +%systemd_preun %{name}-restore.service +%ifarch x86_64 +%systemd_preun %{name}-pre.service +%endif + +%postun +depmod -a > /dev/null 2>&1 || true + +%ifarch x86_64 +%files -f ko.files.list +%endif %files %defattr(-,root,root,-) +%dir /usr/lib/syscare %attr(755,root,root) /usr/bin/syscare +%ifarch x86_64 %attr(755,root,root) /usr/libexec/%{name}/upatch-tool +%attr(640,root,root) /usr/libexec/%{name}/upatch.ko +%attr(644,root,root) /usr/lib/systemd/system/%{name}-pre.service +%endif %attr(755,root,root) /usr/libexec/%{name}/auto-recovery.sh %attr(644,root,root) /usr/lib/systemd/system/%{name}-restore.service -%attr(644,root,root) /usr/lib/systemd/system/%{name}-pre.service %files build %defattr(-,root,root,-) %dir /usr/libexec/%{name} +%attr(755,root,root) /usr/libexec/%{name}/syscare-build +%ifarch x86_64 %attr(755,root,root) /usr/libexec/%{name}/upatch-diff %attr(755,root,root) /usr/libexec/%{name}/upatch-build -%attr(755,root,root) /usr/libexec/%{name}/syscare-build +%endif %changelog -* Mon Nov 28 2022 snoweay - 0.1.1-1 -- First version for test. Support patches restore, remove, insmod upatch.ko. -* Mon Nov 21 2022 snoweay - 0.1.0-1 -- init version for 0.1.1-1. +* Tue Dec 13 2022 snoweay - 1.0.0-1 +- Release the first version 1.0.0.