From 88cebd4b4739baf26d06114b40efb28cbd43a9a4 Mon Sep 17 00:00:00 2001 From: Adam Malinowski Date: Wed, 6 Aug 2014 15:12:15 +0200 Subject: [PATCH] Move user and group creating section from %post to %pre scriptlet This change is needed for creating cynara local state directory with proper user and group. Change-Id: I50d353f7fee1e352c7377a8902a237519c0a6491 --- packaging/cynara.spec | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/packaging/cynara.spec b/packaging/cynara.spec index a3d82f0..937fbea 100644 --- a/packaging/cynara.spec +++ b/packaging/cynara.spec @@ -104,13 +104,7 @@ mkdir -p %{buildroot}/%{state_path} ln -s ../cynara.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/cynara.socket ln -s ../cynara-admin.socket %{buildroot}/usr/lib/systemd/system/sockets.target.wants/cynara-admin.socket -%post -### Add file capabilities if needed -### setcap/getcap binary are useful. To use them you must install libcap and libcap-tools packages -### In such case uncomment Requires with those packages - -systemctl daemon-reload - +%pre id -g %{group_name} > /dev/null 2>&1 if [ $? -eq 1 ]; then groupadd %{group_name} -r > /dev/null 2>&1 @@ -121,6 +115,13 @@ if [ $? -eq 1 ]; then useradd -m %{user_name} -r > /dev/null 2>&1 fi +%post +### Add file capabilities if needed +### setcap/getcap binary are useful. To use them you must install libcap and libcap-tools packages +### In such case uncomment Requires with those packages + +systemctl daemon-reload + if [ $1 = 1 ]; then systemctl enable %{name}.service fi -- 2.7.4