aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2012-04-03 00:11:24 +0000
committerColin Guthrie <colin@mageia.org>2012-04-03 00:11:24 +0000
commita12c6b32f7cbb2e400c60000a0d736dd8d8e598f (patch)
treefacd8abaa89c524519308efc7eccff6583561916
parent515e4357d68ed51b915d1f4ac71332997b676c39 (diff)
downloadrpm-helper-a12c6b32f7cbb2e400c60000a0d736dd8d8e598f.tar
rpm-helper-a12c6b32f7cbb2e400c60000a0d736dd8d8e598f.tar.gz
rpm-helper-a12c6b32f7cbb2e400c60000a0d736dd8d8e598f.tar.bz2
rpm-helper-a12c6b32f7cbb2e400c60000a0d736dd8d8e598f.tar.xz
rpm-helper-a12c6b32f7cbb2e400c60000a0d736dd8d8e598f.zip
add-service: Change the systemd unitdir search order to match upstream.
-rw-r--r--NEWS3
-rwxr-xr-xadd-service16
2 files changed, 10 insertions, 9 deletions
diff --git a/NEWS b/NEWS
index a33517c..17d19f6 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,5 @@
- * always reload systemd unit cache before attempting to restart units
+ * always reload systemd unit cache before attempting to restart units
+ * change the order we search systemd unitdirs to match upstream
2012-03-12 Guillaume Rousse <guillomovitch@gmail.com> 0.24.7
* drop dead code from add-syslog
diff --git a/add-service b/add-service
index bd16c8f..755403a 100755
--- a/add-service
+++ b/add-service
@@ -43,9 +43,9 @@ units_to_enable= # units enabled by msec
systemd_migration_dir=/var/lib/rpm-helper/systemd-migration
mkdir -p "${systemd_migration_dir}"
-SYSTEMUNITDIR=/lib/systemd/system
USERUNITDIR=/etc/systemd/system
RUNTIMEUNITDIR=/run/systemd/system
+SYSTEMUNITDIR=/lib/systemd/system
find_unit() {
unit=$(basename $1)
@@ -56,13 +56,7 @@ find_unit() {
# and disabling units we must use the official name.
searchunit=
- if [ -f "$SYSTEMUNITDIR/$unit" ]; then
- if [ -L "$SYSTEMUNITDIR/$unit" ]; then
- searchunit=$(/usr/bin/readlink "$SYSTEMUNITDIR/$unit")
- else
- searchunit="$SYSTEMUNITDIR/$unit"
- fi
- elif [ -f "$USERUNITDIR/$unit" ]; then
+ if [ -f "$USERUNITDIR/$unit" ]; then
if [ -L "$USERUNITDIR/$unit" ]; then
searchunit=$(/usr/bin/readlink "$USERUNITDIR/$unit")
else
@@ -74,6 +68,12 @@ find_unit() {
else
searchunit="$RUNTIMEUNITDIR/$unit"
fi
+ elif [ -f "$SYSTEMUNITDIR/$unit" ]; then
+ if [ -L "$SYSTEMUNITDIR/$unit" ]; then
+ searchunit=$(/usr/bin/readlink "$SYSTEMUNITDIR/$unit")
+ else
+ searchunit="$SYSTEMUNITDIR/$unit"
+ fi
fi
if [ -n "$searchunit" ]; then
echo -n $searchunit