Only run things on install/uninstall, not upgrade

This commit is contained in:
2025-01-23 15:36:23 +01:00
parent 03b2910573
commit a7f28bcb16
+13 -8
View File
@@ -16,7 +16,7 @@ A runner for Gitea based on act.}
Name: gitea-act-runner
Version: 0.2.10
Release: %autorelease -b 7
Release: %autorelease -b 8
Summary: A runner for Gitea based on act.
%global act_runner_service %{name}.service
@@ -54,19 +54,22 @@ BuildRequires: systemd-rpm-macros
Run gitea actions in docker containers
%pre %{dockerd}
getent group '%{runner_user}' >/dev/null || groupadd -r '%{runner_user}' || :
getent passwd '%{runner_user}' >/dev/null || \
useradd -r -m -F -g '%{runner_user}' -d '/home/%{runner_user}' -s '/sbin/nologin' -c 'act_runner user' '%{runner_user}' || :
if [ $1 -eq 1 ]; then
getent group '%{runner_user}' >/dev/null || groupadd -r '%{runner_user}' || :
getent passwd '%{runner_user}' >/dev/null || \
useradd -r -m -F -g '%{runner_user}' -d '/home/%{runner_user}' -s '/sbin/nologin' -c 'act_runner user' '%{runner_user}' || :
fi
%post %{dockerd}
%systemd_post %{act_runner_service}
%preun %{dockerd}
%systemd_preun %{act_runner_service}
userdel -rZf %{runner_user}
%postun %{dockerd}
userdel -rZf %{runner_user}
if [ $1 -eq 0 ]; then
userdel -rf %{runner_user}
fi
# act_runner with rootless dockerd package
@@ -90,14 +93,16 @@ fi
%post %{dockerd_rootless}
%systemd_user_post %{act_runner_rootless_service} %{dockerd_rootless_service}
loginctl enable-linger %{runner_user_rootless}
if [ $1 -eq 1 ] || [ ! -d /home/%{runner_user_rootless}/act_runner ]; then
loginctl enable-linger %{runner_user_rootless}
echo ' INFO Please read README.%{rootless}-%{dockerd}.md to finish the installation'
fi
%preun %{dockerd_rootless}
%systemd_user_preun %{dockerd_rootless_service} %{act_runner_rootless_service}
loginctl disable-linger %{runner_user_rootless}
if [ $1 -eq 0 ]; then
loginctl disable-linger %{runner_user_rootless}
fi
%postun %{dockerd_rootless}
if [ $1 -eq 0 ]; then