postfixadmin-cli: use readlink if $0 is a symlink

- use readlink if $0 is a symlink (for example in /usr/bin) so that
  postfixadmin-cli.php can be found
  Reported by john doe (johndoe64@SF),
  https://sourceforge.net/tracker/?func=detail&aid=3232183&group_id=191583&atid=937964
- add quoting to all variables


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1023 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 13 years ago
parent 67069e07f8
commit 8f174d430a

@ -23,8 +23,14 @@
#
################################################################################
LIB=${0/%postfixadmin-cli/}
# LIB is expected to be relative to this script (inside the PostfixAdmin sources)
# This breaks if you symlink postfixadmin-cli to /usr/bin or alike. Therefore we
# have to follow the symlink to get the correct path.
self="$0"
test -L "$self" && self="`readlink -f \"$self\"`"
exec php -q ${LIB}postfixadmin-cli.php "$@"
LIB="${self/%postfixadmin-cli/}"
exec php -q "${LIB}postfixadmin-cli.php" "$@"
exit;

Loading…
Cancel
Save