]> git.ipfire.org Git - people/ms/ipfire-3.x.git/commitdiff
avahi: Add systemd service file and scriptlet.
authorStefan Schantl <stefan.schantl@ipfire.org>
Sun, 20 May 2012 10:31:23 +0000 (12:31 +0200)
committerStefan Schantl <stefan.schantl@ipfire.org>
Sun, 20 May 2012 13:26:43 +0000 (15:26 +0200)
Add configure option to install native systemd service file.

Fixes #10134.

avahi/avahi.nm

index fe6839dacb903404eaf00b0be71258df11adc575..3df04f7a9153b9902a9360bf44d94f3a8f0d9caa 100644 (file)
@@ -5,7 +5,7 @@
 
 name       = avahi
 version    = 0.6.30
-release    = 2
+release    = 3
 
 groups     = Networking/Zeroconf
 url        = http://avahi.org/
@@ -38,10 +38,12 @@ build
                pkg-config
                python-devel
                python-dbus
+               systemd-units
        end
 
        configure_options += \
                --with-distro=none \
+               --with-systemdsystemunitdir=%{unitdir} \
                --disable-gdbm \
                --disable-qt3 \
                --disable-qt4 \
@@ -53,7 +55,31 @@ end
 
 packages
        package %{name}
-               requires = libdaemon>=0.14
+               requires
+                       libdaemon>=0.14
+               end
+
+               # Just search for new unit files that were just installed.
+               script postin
+                       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
+                       systemctl --no-reload disable avahi-daemon.service >/dev/null 2>&1 || :
+                       systemctl stop avahi-daemon.service avahi-dnsconfd.service >/dev/null 2>&1 || :
+               end
+
+               # Just tell systemd that unitfiles have been removed.
+               script postun
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+               end
+
+               # Try to restart the service if it is running.
+               script postup
+                       systemctl daemon-reload >/dev/null 2>&1 || :
+                       systemctl try-restart avahi-daemon.service avahi-dnsconfd.service >/dev/null 2>&1 || :
+               end
        end
 
        package %{name}-devel