From 4bf38a829a00f1866e6d93f50d784694e16e93c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A9ri=20Le=20Bouder?= Date: Fri, 30 May 2014 14:47:24 +0200 Subject: [PATCH] introduce $SYSTEMD_SYSTEM_UNIT_DIR export $SYSTEMD_SYSTEM_UNIT_DIR to know where .service files should be moved. So far those files are moved directly in /usr/lib/systemd/system whereas Debian use /lib/systemd/system. We load the value from the systemd pkg-config file. The patch don't use pkg-config directly for three reasons: - environment.d files are run before install.d and the other similar targets, making hard to install an additional dependency - the .pc file can easily be parsed using awk - pkg-config package name is not standard across the different supported distributions $SYSTEMD_SYSTEM_UNIT_DIR default value is /lib because, as pointed by James Slagle, /lib is actually a symlink to /usr/lib/ on Fedora and will work for Debian and Fedora. See: https://bugs.debian.org/719634 Change-Id: I413a92284e6a79e7fcdde99c5138bc3ce8e85e80 --- .../base/environment.d/10-SYSTEMD_SYSTEM_UNIT_DIR.bash | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 elements/base/environment.d/10-SYSTEMD_SYSTEM_UNIT_DIR.bash diff --git a/elements/base/environment.d/10-SYSTEMD_SYSTEM_UNIT_DIR.bash b/elements/base/environment.d/10-SYSTEMD_SYSTEM_UNIT_DIR.bash new file mode 100644 index 000000000..6780f0a87 --- /dev/null +++ b/elements/base/environment.d/10-SYSTEMD_SYSTEM_UNIT_DIR.bash @@ -0,0 +1,8 @@ +SYSTEMD_PC_FILE="/usr/share/pkgconfig/systemd.pc" +SYSTEMD_SYSTEM_UNIT_DIR="/lib" +if [ -f $SYSTEMD_PC_FILE ]; then + SYSTEMD_SYSTEM_UNIT_DIR=$(awk \ + '/systemdsystemunitdir=/ {split($0,a,"=");print a[2]}' \ + $SYSTEMD_PC_FILE) +fi +export SYSTEMD_SYSTEM_UNIT_DIR