diff options
author | Gwenolé Beauchesne <gbeauchesne@mandriva.org> | 2005-08-07 15:46:51 +0000 |
---|---|---|
committer | Gwenolé Beauchesne <gbeauchesne@mandriva.org> | 2005-08-07 15:46:51 +0000 |
commit | d67ec9d4b36ff59b405529a32ef793f24b402e4b (patch) | |
tree | f7c8a08a41476d7b97b8591fc8f114f8fa5d48ae /multiarch-dispatch | |
parent | 65ad81725ca65a59be373d4bd3de5fb99ea5aebf (diff) | |
download | multiarch-utils-d67ec9d4b36ff59b405529a32ef793f24b402e4b.tar multiarch-utils-d67ec9d4b36ff59b405529a32ef793f24b402e4b.tar.gz multiarch-utils-d67ec9d4b36ff59b405529a32ef793f24b402e4b.tar.bz2 multiarch-utils-d67ec9d4b36ff59b405529a32ef793f24b402e4b.tar.xz multiarch-utils-d67ec9d4b36ff59b405529a32ef793f24b402e4b.zip |
handle symlinks to multiarch binaries and cases where command name contains
spaces
Diffstat (limited to 'multiarch-dispatch')
-rwxr-xr-x | multiarch-dispatch | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/multiarch-dispatch b/multiarch-dispatch index 886bac2..61ce0bd 100755 --- a/multiarch-dispatch +++ b/multiarch-dispatch @@ -13,7 +13,19 @@ if [[ "$0" = "/usr/bin/multiarch-dispatch" ]]; then exit 0 fi -bin=`dirname $0`/`multiarch-platform`/${0##*/} +# go through symlinks until multiarch-dispatch leaf is reached +mprog="$0" +mcomp="$mprog" +while [[ -L "$mcomp" ]]; do + mprog="$mcomp" + mcomp=`readlink "$mprog"` + case "$mcomp" in + /*) ;; + *) mcomp=`dirname "$mprog"`/"$mcomp";; + esac +done + +bin=`dirname "$mprog"`/`multiarch-platform`/"${mprog##*/}" if [[ ! -x "$bin" ]]; then echo "Cannot execute $bin" > /dev/stderr |