aboutsummaryrefslogtreecommitdiffstats
path: root/add-service
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 /add-service
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
Diffstat (limited to 'add-service')
-rwxr-xr-xadd-service28
1 files changed, 11 insertions, 17 deletions
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