From a17d9372bcf3a4459afca4c183dcdfc4dc123ad2 Mon Sep 17 00:00:00 2001 From: samuel Date: Wed, 1 Feb 2023 15:31:58 +0100 Subject: [PATCH] [fix] Check if package is actually uninstalling in preun and postun --- netoik-api.spec | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/netoik-api.spec b/netoik-api.spec index 641cf64..52e1aa7 100644 --- a/netoik-api.spec +++ b/netoik-api.spec @@ -26,19 +26,17 @@ Netoik rest API server %make_install %pre -useradd --no-create-home --system --user-group %{name} +id %{name} || useradd --no-create-home --shell=%(which nologin) --user-group %{name} %post -systemctl stop %{name}-server.service systemctl daemon-reload -systemctl start %{name}-server.service +systemctl restart %{name}-server.service %preun -systemctl stop %{name}-server.service +$1 -eq 0 && systemctl stop %{name}-server.service %postun -systemctl daemon-reload -userdel %{name} +$1 -eq 0 && systemctl daemon-reload && userdel %{name} %files %attr(755, root, root) %dir %{_var}/%{name}