]> git.ipfire.org Git - people/ms/ipfire-3.x.git/commitdiff
radvd: Add scriptlet for user / group creation and systemd interaction.
authorStefan Schantl <stefan.schantl@ipfire.org>
Thu, 13 Oct 2011 19:25:26 +0000 (21:25 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 15 Oct 2011 17:16:57 +0000 (19:16 +0200)
Fixes #207.

Conflicts:

radvd/radvd.nm

radvd/radvd.nm

index bf4b6507e937a39fe398fdd364761d4bd175f7b1..89d91a2d14650e7d2091fddcbdaa9ef994c294f5 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = radvd
 version    = 1.8.3
-release    = 1
+release    = 2
 
 groups     = System/Daemons
 url        = http://www.litech.org/radvd/
@@ -41,6 +41,41 @@ end
 
 packages
        package %{name}
-               reuires = /lib/network/network-radvd-config
+               requires = /lib/network/network-radvd-config
+
+               prerequires += shadow-utils
+
+               script prein
+                       getent group radvd >/dev/null || groupadd -r radvd
+
+                       # The radvd user also needs to be in the wheel group to get access to
+                       # /proc.
+                       getent passwd radvd >/dev/null || \
+                               useradd -r -g radvd -G wheel -d / -s /sbin/nologin \
+                                       -c "User for the Router Advertisement daemon." radvd
+                       exit  0
+               end
+
+               # Just search for new unit files that were just installed.
+               script postin
+                       /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               # Disable the service that is to be removed and stop it if it is still running.
+               script preun
+                       /bin/systemctl --no-reload disable radvd.service >/dev/null 2>&1 || :
+                       /bin/systemctl stop radvd.service >/dev/null 2>&1 || :
+               end
+
+               # Just tell systemd that unitfiles have been removed.
+               script postun
+                       /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               # Try to restart the service if it is running.
+               script postup
+                       /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+                       /bin/systemctl try-restart radvd.service >/dev/null 2>&1 || :
+               end
        end
 end