diff options
-rw-r--r-- | NEWS | 1 | ||||
-rwxr-xr-x | add-service | 28 |
2 files changed, 12 insertions, 17 deletions
@@ -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 |