]> git.ipfire.org Git - people/amarx/ipfire-3.x.git/commitdiff
pdns-recursor: Add scriptlets.
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 19 Oct 2011 12:40:42 +0000 (14:40 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 19 Oct 2011 12:40:42 +0000 (14:40 +0200)
The service is enabled after installation.

pdns-recursor/pdns-recursor.nm

index e8d839d57b32de2a46d6d066da995c8d28b139fe..80f295211fcba26cc143cc97f624b01c0f34a120 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = pdns-recursor
 version    = 3.3
-release    = 4
+release    = 5
 
 groups     = Networking/DNS
 url        = http://powerdns.com/
@@ -50,9 +50,38 @@ build
        end
 end
 
-# XXX Need to create user and group "pdns-recursor" at installation
-# useradd -r -g pdns-recursor pdns-recursor -d /var/lib/pdns-recursor -s /sbin/nologin
-
 packages
        package %{name}
+               configfiles
+                       /etc/%{name}/recursor.conf
+               end
+
+               prerequires = shadow-utils systemd-units
+
+               script prein
+                       getent group pdns-recursor >/dev/null || groupadd -r pdns-recursor
+                       getent passwd pdns-recursor >/dev/null || \
+                               useradd -r -g pdns-recursor -d /var/lib/pdns-recursor -s /sbin/nologin \
+                                       pdns-recursor
+               end
+
+               script postin
+                       /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+                       /bin/systemctl --no-reload enable pdns-recursor.service >/dev/null 2>&1 || :
+               end
+
+               script preun
+                       /bin/systemctl --no-reload disable pdns-recursor.service >/dev/null 2>&1 || :
+                       /bin/systemctl stop pdns-recursor.service >/dev/null 2>&1 || :
+               end
+
+               script postun
+                       /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               script postup
+                       /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+                       /bin/systemctl try-restart pdns-recursor.service >/dev/null 2>&1 || :
+               end
+       end
 end