add %pre script

This commit is contained in:
fu-shanqing 2022-09-01 16:13:38 +08:00
parent 2f1ff3ba53
commit 551dee3677

View File

@ -2,10 +2,11 @@
%global __cargo_skip_build 0
%define debug_package %{nil}
%global crate zincati
%global zcuid 986
Name: rust-%{crate}
Version: 0.0.24
Release: 1
Release: 2
Summary: Update agent for NestOS
License: ASL 2.0
URL: https://crates.io/crates/%{crate}
@ -50,6 +51,15 @@ License: ASL 2.0 and BSD and MIT and MPLv2.0 and zlib
%{_datadir}/polkit-1/rules.d/zincati.rules
%{_datadir}/polkit-1/actions/org.coreos.zincati.*
%pre
if ! getent group zincati >/dev/null; then
groupadd -g %{zcuid} -r zincati
fi
if ! getent passwd zincati >/dev/null; then
useradd -r -g zincati -d /run/%{crate} zincati \
-s /sbin/nologin -c "Zincati user for auto-updates"
fi
%post -n %{crate}
%systemd_post zincati.service
@ -118,6 +128,9 @@ ln -snf /run/%{crate}/public/metrics.promsock %{buildroot}/run/%{crate}/private/
%endif
%changelog
* Thu Sep 01 2022 fushanqing <fushanqing@kylinos.cn> - 0.0.24-2
- add %pre script
* Wed Jun 08 2022 fushanqing <fushanqing@kylinos.cn> - 0.0.24-1
- update to 0.0.24