From a9f7748885528246970fea2e1d8e249e4dbd8065 Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Thu, 4 Sep 2014 01:02:39 +0200 Subject: [PATCH] build: provide a sysusers.d file This allows systemd-sysusers to create _lldpd user/group. See: http://www.freedesktop.org/software/systemd/man/sysusers.d.html This is currently untested. --- .travis/run.sh | 1 + Makefile.am | 1 + configure.ac | 9 ++++++++- redhat/lldpd.spec | 1 + src/daemon/Makefile.am | 4 ++++ src/daemon/lldpd.sysusers.conf.in | 6 ++++++ 6 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 src/daemon/lldpd.sysusers.conf.in diff --git a/.travis/run.sh b/.travis/run.sh index 3174186d..7e54c87b 100755 --- a/.travis/run.sh +++ b/.travis/run.sh @@ -28,5 +28,6 @@ else # Regular build LLDPD_CONFIG_ARGS="$LLDPD_CONFIG_ARGS --with-systemdsystemunitdir=no" LLDPD_CONFIG_ARGS="$LLDPD_CONFIG_ARGS --with-launchddaemonsdir=no" + LLDPD_CONFIG_ARGS="$LLDPD_CONFIG_ARGS --with-sysusersdir=no" make distcheck DISTCHECK_CONFIGURE_FLAGS="$LLDPD_CONFIG_ARGS" fi diff --git a/Makefile.am b/Makefile.am index 07390fd8..f60caf95 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,5 +35,6 @@ MOSTLYCLEANFILES = $(DX_CLEANFILES) # systemd and launchd files are not installed in the prefix, don't # request them for distcheck DISTCHECK_CONFIGURE_FLAGS = \ + --with-sysusersdir=no \ --with-systemdsystemunitdir=no \ --with-launchddaemonsdir=no diff --git a/configure.ac b/configure.ac index a85d2d15..34fe40ea 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,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_FILES([src/daemon/lldpd.service src/daemon/lldpd.sysusers.conf]) AC_CONFIG_FILES([src/daemon/lldpd.8 src/client/lldpcli.8]) AC_CONFIG_MACRO_DIR([m4]) AC_SUBST([CONFIGURE_ARGS], [$ac_configure_args]) @@ -225,6 +225,13 @@ AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir]) AM_CONDITIONAL(HAVE_SYSTEMDSYSTEMUNITDIR, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ]) +# sysusers +lldp_ARG_WITH([sysusersdir], [Directory for sysusers files], + [$($PKG_CONFIG --variable=sysusersdir systemd 2> /dev/null)]) +AC_SUBST([sysusersdir], [$with_sysusersdir]) +AM_CONDITIONAL(HAVE_SYSUSERSDIR, + [test -n "$with_sysusersdir" -a "x$with_sysusersdir" != xno ]) + # Systemtap/DTrace lldp_SYSTEMTAP diff --git a/redhat/lldpd.spec b/redhat/lldpd.spec index 53f0ee0b..1781b20b 100644 --- a/redhat/lldpd.spec +++ b/redhat/lldpd.spec @@ -130,6 +130,7 @@ This package is required to develop alternate clients for lldpd. --with-privsep-group=%lldpd_group \ --with-privsep-chroot=%lldpd_chroot \ --with-systemdsystemunitdir=no \ + --with-sysusersdir=no \ --prefix=/usr --localstatedir=%{_localstatedir} --sysconfdir=/etc --libdir=%{_libdir} \ --docdir=%{_docdir}/lldpd diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am index 39ba12aa..e234f246 100644 --- a/src/daemon/Makefile.am +++ b/src/daemon/Makefile.am @@ -144,3 +144,7 @@ endif if HAVE_SYSTEMDSYSTEMUNITDIR systemdsystemunit_DATA = lldpd.service endif + +if HAVE_SYSUSERSDIR +sysusers_DATA = lldpd.sysusers.conf +endif diff --git a/src/daemon/lldpd.sysusers.conf.in b/src/daemon/lldpd.sysusers.conf.in new file mode 100644 index 00000000..7cbf50a2 --- /dev/null +++ b/src/daemon/lldpd.sysusers.conf.in @@ -0,0 +1,6 @@ +# System user and group for lldpd +# @PRIVSEP_USER@:@PRIVSEP_GROUP@ + +# Type Name ID GECOS Home +u @PRIVSEP_USER@ - "lldpd user" @PRIVSEP_CHROOT@ +m @PRIVSEP_USER@ @PRIVSEP_GROUP@ -- 2.39.5