Skip to content

Commit

Permalink
[Issue networkupstools#1030] Deliver systemd-tmpfiles config to pre-c…
Browse files Browse the repository at this point in the history
…reate runtime locations
  • Loading branch information
jimklimov committed May 28, 2021
1 parent c06b98c commit d513847
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ DISTCHECK_VALGRIND_FLAGS = --with-all=auto --with-ssl=auto --with-doc=skip --wit
DISTCHECK_CONFIGURE_FLAGS = ${DISTCHECK_FLAGS} \
--with-systemdsystemunitdir='$${prefix}/lib/systemd/system' \
--with-systemdshutdowndir='$${prefix}/lib/systemd/system-shutdown' \
--with-systemdtmpfilesdir='$${prefix}/usr/lib/tmpfiles.d' \
--with-augeas-lenses-dir='$${prefix}/usr/share/augeas/lenses' \
--with-hotplug-dir='$${prefix}/etc/hotplug' \
--with-udev-dir='$${prefix}/etc/udev' \
Expand Down
13 changes: 13 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1472,6 +1472,7 @@ AM_CONDITIONAL(HAVE_SYSTEMD, test "$systemdsystemunitdir" != "")
dnl This option is only provided so that make distcheck can override it,
dnl otherwise we ask pkg-config whenever --with-systemdsystemunitdir is
dnl given

AC_ARG_WITH([systemdshutdowndir],
AS_HELP_STRING([--with-systemdshutdowndir=DIR], [Directory for systemd shutdown scripts (auto)]),
[systemdshutdowndir=${withval}])
Expand All @@ -1482,6 +1483,16 @@ if test -n "${systemdsystemunitdir}"; then
esac
fi

AC_ARG_WITH([systemdtmpfilesdir],
AS_HELP_STRING([--with-systemdtmpfilesdir=DIR], [Directory for systemd tmpfiles scripts (auto)]),
[systemdtmpfilesdir=${withval}])
if test -n "${systemdsystemunitdir}"; then
case "${systemdtmpfilesdir}" in
yes|auto|"")
systemdtmpfilesdir=`$PKG_CONFIG --variable=tmpfilesdir systemd`
esac
fi

dnl
dnl Tests for CppUnit availability and usability (will be built if we can,
dnl and if valgrind is enabled for this configuration - reported below).
Expand Down Expand Up @@ -1909,6 +1920,7 @@ AC_SUBST(htmldir)
AC_SUBST(pkgconfigdir)
AC_SUBST(systemdsystemunitdir)
AC_SUBST(systemdshutdowndir)
AC_SUBST(systemdtmpfilesdir)
AC_SUBST(auglensdir)
AC_SUBST(hotplugdir)
AC_SUBST(udevdir)
Expand Down Expand Up @@ -2058,6 +2070,7 @@ AC_OUTPUT([
scripts/upsdrvsvcctl/nut-driver-enumerator.sh
scripts/upsdrvsvcctl/upsdrvsvcctl
scripts/systemd/Makefile
scripts/systemd/nut-common.tmpfiles
scripts/systemd/[email protected]
scripts/systemd/nut-monitor.service
scripts/systemd/nut-server.service
Expand Down
21 changes: 21 additions & 0 deletions docs/configure.txt
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,27 @@ Use --with-systemdsystemunitdir to detect the settings using pkg-config.

Use --with-systemdsystemunitdir=no to disable this feature altogether.

--with-systemdshutdowndir=PATH

Where to install Linux systemd unit definitions for shutdown handling.
Useless and harmless on other OSes, including Linux distributions
without systemd, just adding a little noise to configure script output.

Use --with-systemdshutdowndir to detect the settings using pkg-config.

Use --with-systemdshutdowndir=no to disable this feature altogether.

--with-systemdtmpfilesdir=PATH

Where to install Linux systemd configuration for tmpfiles handling (the
automatically created locations for PID, state and similar run-time files).
Useless and harmless on other OSes, including Linux distributions
without systemd, just adding a little noise to configure script output.

Use --with-systemdtmpfilesdir to detect the settings using pkg-config.

Use --with-systemdtmpfilesdir=no to disable this feature altogether.

--with-augeas-lenses-dir=PATH

Where to install Augeas configuration-management lenses. Only useful and valid
Expand Down
5 changes: 4 additions & 1 deletion docs/nut.dict
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
personal_ws-1.1 en 2549 utf-8
personal_ws-1.1 en 2556 utf-8
AAS
ACFAIL
ACFREQ
Expand Down Expand Up @@ -2322,7 +2322,9 @@ sysconfig
syslog
systemctl
systemd
systemdshutdowndir
systemdsystemunitdir
systemdtmpfilesdir
systemhours
systemmode
systemtest
Expand Down Expand Up @@ -2354,6 +2356,7 @@ timername
tiocm
tios
tmp
tmpfiles
toolchain
topbot
tport
Expand Down
1 change: 1 addition & 0 deletions scripts/systemd/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/nut-common.tmpfiles
/nut-driver.service
/[email protected]
/nut-driver.target
Expand Down
6 changes: 5 additions & 1 deletion scripts/systemd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ systemdsystemunit_DATA = \
nut-driver.target \
nut.target

systemdtmpfiles_DATA = \
nut-common.tmpfiles

EXTRA_DIST += nut-driver.target nut.target

systemdshutdown_SCRIPTS = nutshutdown
Expand All @@ -20,7 +23,8 @@ libexec_SCRIPTS = ../upsdrvsvcctl/nut-driver-enumerator.sh
sbin_SCRIPTS = ../upsdrvsvcctl/upsdrvsvcctl

else
EXTRA_DIST += [email protected] nut-monitor.service.in \
EXTRA_DIST += \
nut-common.tmpfiles.in [email protected] nut-monitor.service.in \
nut-server.service.in nutshutdown.in nut-driver.target nut.target \
nut-driver-enumerator.path.in nut-driver-enumerator.service.in
endif
Expand Down
7 changes: 7 additions & 0 deletions scripts/systemd/nut-common.tmpfiles.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# State file (e.g. upsd to driver) and pidfile location for NUT:
d @runbasedir@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - -
X @runbasedir@/nut
d @statepath@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - -
X @statepath@/nut
d @pidpath@/nut 0770 @RUN_AS_USER@ @RUN_AS_GROUP@ - -
X @pidpath@/nut

0 comments on commit d513847

Please sign in to comment.