]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
systemd: ship lldpd.service file if possible
authorVincent Bernat <bernat@luffy.cx>
Wed, 14 Aug 2013 16:46:56 +0000 (18:46 +0200)
committerVincent Bernat <bernat@luffy.cx>
Wed, 14 Aug 2013 16:46:56 +0000 (18:46 +0200)
configure.ac
src/daemon/Makefile.am
src/daemon/lldpd.service.in [moved from debian/lldpd.service with 56% similarity]

index b95035ce22ccdbee86cbec04acc0f09f409740cc..504b3569ab83f64a2eb39a021ff8ec08bef1f7e1 100644 (file)
@@ -19,6 +19,7 @@ AC_CONFIG_FILES([Makefile src/Makefile src/compat/Makefile src/daemon/Makefile
 AC_CONFIG_FILES([osx/Makefile osx/distribution.xml osx/im.bernat.lldpd.plist])
 AC_CONFIG_FILES([osx/scripts/preinstall], [chmod +x osx/scripts/preinstall])
 AC_CONFIG_FILES([osx/scripts/postinstall], [chmod +x osx/scripts/postinstall])
+AC_CONFIG_FILES([src/daemon/lldpd.service])
 AC_CONFIG_MACRO_DIR([m4])
 AC_SUBST([CONFIGURE_ARGS], [$ac_configure_args])
 
@@ -178,7 +179,11 @@ if test x"$with_json" = x"yes"; then
 fi
 
 # OS X launchd support
-lldp_ARG_WITH([launchd-daemons-path], [Path to system-wide daemons configuration files (OSX)], [/Library/LaunchDaemons])
+lldp_ARG_WITH([launchd-daemons-path], [Directory for launchd configuration file (OSX)], [/Library/LaunchDaemons])
+
+# Systemd
+lldp_ARG_WITH([systemdsystemunitdir], [Directory for systemd service files],
+              [$($PKG_CONFIG --variable=systemdsystemunitdir systemd || echo no)])
 
 # Privsep settings
 lldp_ARG_WITH([privsep-user], [Which user to use for privilege separation], [_lldpd])
index 339c2913b315b33175d3892c10f69fb782eba5fb..54dda7b1916a74f279662c8697f57e6739cf5a73 100644 (file)
@@ -99,3 +99,10 @@ event.c: $(top_builddir)/libevent/libevent.la
 $(top_builddir)/libevent/libevent.la: $(top_srcdir)/libevent/*.c $(top_srcdir)/libevent/*.h
        (cd $(top_builddir)/libevent && $(MAKE))
 endif
+
+## systemd service file
+install-data-local:
+       [ x"@SYSTEMDSYSTEMUNITDIR@" = x"no" ] || install -m 0755 -d $(DESTDIR)@SYSTEMDSYSTEMUNITDIR@
+       [ x"@SYSTEMDSYSTEMUNITDIR@" = x"no" ] || install -m 0644 -d lldpd.service $(DESTDIR)@SYSTEMDSYSTEMUNITDIR@
+uninstall-local:
+       [ x"@LAUNCHD_DAEMONS_PATH@" = x"no" ] || rm -f $(DESTDIR)@SYSTEMDSYSTEMUNITDIR@/lldpd.service
similarity index 56%
rename from debian/lldpd.service
rename to src/daemon/lldpd.service.in
index aee828765324dc113f0a8e1e19bc8fe847ba4fb1..61e157b634f8812ed2327f90470ddb2b3211f89d 100644 (file)
@@ -6,9 +6,9 @@ Documentation=man:lldpd(8)
 Type=notify
 NotifyAccess=main
 EnvironmentFile=-/etc/default/lldpd
-ExecStart=/usr/sbin/lldpd $DAEMON_ARGS
-ExecStartPre=mkdir -p /var/run/lldpd/etc
-ExecStartPre=cp /etc/localtime /var/run/lldpd/etc/localtime
+ExecStart=@prefix@/sbin/lldpd $DAEMON_ARGS
+ExecStartPre=mkdir -p @PRIVSEP_CHROOT@/etc
+ExecStartPre=cp /etc/localtime @PRIVSEP_CHROOT@/etc/localtime
 Restart=on-failure
 
 [Install]