[avahi] [PATCH v2] autoipd: add templated systemd unit

Josh Cartwright josh.cartwright at ni.com
Tue Jan 29 10:58:28 PST 2013


Support the execution of avahi-autoipd directly from systemd.

Signed-off-by: Josh Cartwright <josh.cartwright at ni.com>
---
v2: fixed EXTRA_DIST to include the service file with the .in suffix

 avahi-autoipd/Makefile.am               | 24 +++++++++++++++++++++---
 avahi-autoipd/avahi-autoipd at .service.in | 27 +++++++++++++++++++++++++++
 2 files changed, 48 insertions(+), 3 deletions(-)
 create mode 100644 avahi-autoipd/avahi-autoipd at .service.in

diff --git a/avahi-autoipd/Makefile.am b/avahi-autoipd/Makefile.am
index 56f7a35..b8851d2 100644
--- a/avahi-autoipd/Makefile.am
+++ b/avahi-autoipd/Makefile.am
@@ -48,6 +48,15 @@ else
 avahi_autoipd_SOURCES += iface-linux.c
 endif
 
+%.service: %.service.in
+	$(AM_V_GEN)sed -e 's, at sbindir\@,$(sbindir),g' $< > $@
+
+if HAVE_SYSTEMD
+systemdsystemunit_DATA = \
+	avahi-autoipd at .service
+endif
+
+
 nodist_pkgsysconf_SCRIPTS = avahi-autoipd.action
 
 if TARGET_FREEBSD
@@ -89,6 +98,15 @@ endif
 endif
 endif
 
-EXTRA_DIST = dhclient-enter-hook.in dhclient-exit-hook.in avahi-autoipd.action.linux avahi-autoipd.action.bsd
-
-CLEANFILES = dhclient-enter-hook dhclient-exit-hook avahi-autoipd.action
+EXTRA_DIST = \
+	dhclient-enter-hook.in \
+	dhclient-exit-hook.in \
+	avahi-autoipd.action.linux \
+	avahi-autoipd.action.bsd \
+	avahi-autoipd at .service.in
+
+CLEANFILES = \
+	dhclient-enter-hook \
+	dhclient-exit-hook \
+	avahi-autoipd.action \
+	$(systemdsystemunit_DATA)
diff --git a/avahi-autoipd/avahi-autoipd at .service.in b/avahi-autoipd/avahi-autoipd at .service.in
new file mode 100644
index 0000000..32f4bda
--- /dev/null
+++ b/avahi-autoipd/avahi-autoipd at .service.in
@@ -0,0 +1,27 @@
+# This file is part of avahi.
+#
+# avahi is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# avahi is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+# License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with avahi; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+# USA.
+
+[Unit]
+Description=Avahi IPv4LL network address configuration daemon
+
+[Service]
+ExecStart=@sbindir@/avahi-autoipd %I
+ExecReload=@sbindir@/avahi-autoipd --refresh %I
+ExecStop=@sbindir@/avahi-autoipd --kill %I
+
+[Install]
+WantedBy=network.target
-- 
1.8.1.2


More information about the avahi mailing list