aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2012-09-30 14:41:52 +0000
committerColin Guthrie <colin@mageia.org>2012-09-30 14:41:52 +0000
commit6f12178282416be7811bc75566fdcf928a68b157 (patch)
treef69691906aee76478a1ff60549e572ee086c4c01
parentf2f4d7a7eef3271592381b9383708a8a4633053a (diff)
downloadrpm-helper-6f12178282416be7811bc75566fdcf928a68b157.tar
rpm-helper-6f12178282416be7811bc75566fdcf928a68b157.tar.gz
rpm-helper-6f12178282416be7811bc75566fdcf928a68b157.tar.bz2
rpm-helper-6f12178282416be7811bc75566fdcf928a68b157.tar.xz
rpm-helper-6f12178282416be7811bc75566fdcf928a68b157.zip
Make the code a little more compact + deal slightly better with non-releative symlinks in chroots
-rw-r--r--NEWS1
-rwxr-xr-xadd-service28
2 files changed, 12 insertions, 17 deletions
diff --git a/NEWS b/NEWS
index baa19d8..fce4c05 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@
* prefer native systemd install rules over manual symlinking
* mark a systemd-only service as "migrated" on install to avoid checking for
sysvinit migration when next upgraded.
+ * deal slightly better with non-releative symlinks in chroots in units names
2012-04-29 Colin Guthrie <colin@mageia.org> 0.24.9
* fix handling of masked and symlinked unit names
diff --git a/add-service b/add-service
index dc09cb7..6a52e2f 100755
--- a/add-service
+++ b/add-service
@@ -56,24 +56,18 @@ find_unit() {
# and disabling units we must use the official name.
searchunit=
- if [ -e "$USERUNITDIR/$unit" ]; then
- if [ -L "$USERUNITDIR/$unit" ]; then
- searchunit=$(/usr/bin/readlink -f "$USERUNITDIR/$unit")
- else
- searchunit="$USERUNITDIR/$unit"
- fi
- elif [ -e "$RUNTIMEUNITDIR/$unit" ]; then
- if [ -L "$RUNTIMEUNITDIR/$unit" ]; then
- searchunit=$(/usr/bin/readlink -f "$RUNTIMEUNITDIR/$unit")
- else
- searchunit="$RUNTIMEUNITDIR/$unit"
- fi
+ if [ -L "$USERUNITDIR/$unit" ]; then
+ searchunit=$(/usr/bin/readlink -m "$USERUNITDIR/$unit")
+ elif [ -e "$USERUNITDIR/$unit" ]; then
+ searchunit="$USERUNITDIR/$unit"
+ elif [ -L "$RUNTIMEUNITDIR/$unit" ]; then
+ searchunit=$(/usr/bin/readlink -m "$RUNTIMEUNITDIR/$unit")
+ else [ -e "$RUNTIMEUNITDIR/$unit" ]; then
+ searchunit="$RUNTIMEUNITDIR/$unit"
+ elif [ -L "$SYSTEMUNITDIR/$unit" ]; then
+ searchunit=$(/usr/bin/readlink -m "$SYSTEMUNITDIR/$unit")
elif [ -e "$SYSTEMUNITDIR/$unit" ]; then
- if [ -L "$SYSTEMUNITDIR/$unit" ]; then
- searchunit=$(/usr/bin/readlink -f "$SYSTEMUNITDIR/$unit")
- else
- searchunit="$SYSTEMUNITDIR/$unit"
- fi
+ searchunit="$SYSTEMUNITDIR/$unit"
fi
if [ -n "$searchunit" ]; then
echo -n $searchunit