[Nut-upsdev] [PATCH] Detect correct systemdsystemshutdowndir

Stanislav Brabec sbrabec at suse.cz
Thu Apr 13 15:54:19 UTC 2017


nut hardcodes systemdsystemshutdowndir to
${libdir}/systemd/system-shutdown. This is not valid:
- Executable helpers are installed to ${libexecdir}, which is different
  from ${libdir} on bi-arch systems.
- Even if nut will use ${libexecdir}, it could be different from
  systemd libexecdir.

That is why it is better to check systemd.pc for the correct path.
That path is stored as systemdutildir. In older systemd versions,
systemdutildir does not exist yet, and we need to use
systemdsystemunitdir can be used.

Signed-off-by: Stanislav Brabec <sbrabec at suse.cz>
---
 configure.ac | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 6f8a40c4..f9a298d9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1197,7 +1197,12 @@ dnl Override installation directory, with the local installation
 dnl prefix. This is needed for 'distcheck*' targets, otherwise
 dnl files will try to get intalled to the actual system directories
 if test -n "${systemdsystemunitdir}"; then
-	systemdsystemshutdowndir="${libdir}/systemd/system-shutdown"
+	systemdutildir=`$PKG_CONFIG --variable=systemdutildir systemd`
+	if test -n "${systemdutildir}"; then
+		systemdsystemshutdowndir="${systemdutildir}/system-shutdown"
+	else
+		systemdsystemshutdowndir="${systemdsystemunitdir}/system-shutdown"
+	fi
 	AC_MSG_RESULT(using ${systemdsystemunitdir})
 else
 	AC_MSG_RESULT(no)
-- 
2.12.2

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SUSE LINUX, s. r. o.                         e-mail: sbrabec at suse.com
Křižíkova 148/34 (Corso IIa)                  tel: +49 911 7405384547
186 00 Praha 8-Karlín                          fax:  +420 284 084 001
Czech Republic                                    http://www.suse.cz/
PGP: 830B 40D5 9E05 35D8 5E27 6FA3 717C 209F A04F CD76



More information about the Nut-upsdev mailing list