加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
syscare.spec 3.77 KB
一键复制 编辑 原始数据 按行查看 历史
RenoSeven 提交于 2024-09-18 18:40 . release 1.2.2-2
%define build_version %{version}-%{release}
############################################
############ Package syscare ###############
############################################
Name: syscare
Version: 1.2.2
Release: 2
Summary: System hot-fix service
License: MulanPSL-2.0 and GPL-2.0-only
URL: https://gitee.com/openeuler/syscare
Source0: %{name}-%{version}.tar.gz
BuildRequires: cmake >= 3.14 make
BuildRequires: rust >= 1.51 cargo >= 1.51
BuildRequires: gcc gcc-c++
Requires: coreutils systemd
Requires: kpatch-runtime
Excludearch: loongarch64
Patch0001: 0001-fix-kernel-patch-ACCEPTED-change-to-DEACTIVED-after-.patch
Patch0002: 0002-fix-some-clean-code-problem.patch
Patch0003: 0003-upatch-helper-fix-object-upatch-id-duplicated-issue.patch
############### Description ################
%description
SysCare is a system-level hot-fix service that provides security patches and system error hot-fixes for the operating system.
The host can fix the system problem without rebooting.
############## BuildPreparare ##############
%prep
%autosetup -p1
################## Build ###################
%build
mkdir -p build
cd build
cmake \
-DENABLE_ASAN=0 \
-DENABLE_GCOV=0 \
-DBUILD_VERSION=%{build_version} \
-DCMAKE_INSTALL_PREFIX=/usr \
..
make
################# Install ##################
%install
cd build
%make_install
############### PostInstall ################
%post
mkdir -p /usr/lib/syscare/patches
systemctl daemon-reload
systemctl enable syscare
systemctl start syscare
############### PreUninstall ###############
%preun
if [ "$1" -eq 0 ]; then
systemctl daemon-reload
systemctl stop syscare
systemctl disable syscare
fi
############## PostUninstall ###############
%postun
if [ "$1" -eq 0 ] || { [ -n "$2" ] && [ "$2" -eq 0 ]; }; then
# Remove patch directory
rm -rf /usr/lib/syscare
# Remove log directory
rm -f /var/log/syscare/syscared_r*.log
rm -f /var/log/syscare/syscared_r*.log.gz
if [ -z "$(ls -A /var/log/syscare)" ]; then
rm -rf /var/log/syscare
fi
# Remove run directory
rm -f /var/run/syscare/patch_op.lock
rm -f /var/run/syscare/syscared.*
if [ -z "$(ls -A /var/run/syscare)" ]; then
rm -rf /var/run/syscare
fi
fi
################## Files ###################
%files
%defattr(-,root,root,0555)
%dir /usr/libexec/syscare
%attr(0555,root,root) /usr/bin/syscare
%attr(0550,root,root) /usr/bin/syscared
%attr(0550,root,root) /usr/libexec/syscare/upatch-manage
%attr(0550,root,root) /usr/lib/systemd/system/syscare.service
############################################
########## Package syscare-build ###########
############################################
%package build
Summary: Syscare build tools.
BuildRequires: elfutils-libelf-devel
Requires: coreutils
Requires: patch
Requires: kpatch
Requires: tar gzip
Requires: rpm rpm-build
############### Description ################
%description build
Syscare patch building toolset.
################## Files ###################
%files build
%defattr(-,root,root,0555)
%dir /usr/libexec/syscare
%attr(555,root,root) /usr/libexec/syscare/syscare-build
%attr(555,root,root) /usr/libexec/syscare/upatch-build
%attr(555,root,root) /usr/libexec/syscare/upatch-diff
%attr(555,root,root) /usr/libexec/syscare/upatch-helper
%attr(555,root,root) /usr/libexec/syscare/upatch-cc
%attr(555,root,root) /usr/libexec/syscare/upatch-c++
############################################
################ Change log ################
############################################
%changelog
* Wed Sep 18 2024 renoseven<dev@renoseven.net> - 1.2.2-2
- syscared: fix kernel patch apply failure issue
- upatch-helper: fix object upatch id duplicated issue
* Fri Aug 16 2024 renoseven<dev@renoseven.net> - 1.2.2-1
- Release version 1.2.2-1.
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化