diff options
author | Gwenolé Beauchesne <gbeauchesne@mandriva.org> | 2005-01-31 16:09:36 +0000 |
---|---|---|
committer | Gwenolé Beauchesne <gbeauchesne@mandriva.org> | 2005-01-31 16:09:36 +0000 |
commit | 651c73d0db4b21fe4b4120f9211c6243e15f9118 (patch) | |
tree | e3a4d668a49a1333594de2e37a91d0760887b20d | |
parent | b793e98374d7ec77aa916da3a3546f4de0f6f198 (diff) | |
download | multiarch-utils-651c73d0db4b21fe4b4120f9211c6243e15f9118.tar multiarch-utils-651c73d0db4b21fe4b4120f9211c6243e15f9118.tar.gz multiarch-utils-651c73d0db4b21fe4b4120f9211c6243e15f9118.tar.bz2 multiarch-utils-651c73d0db4b21fe4b4120f9211c6243e15f9118.tar.xz multiarch-utils-651c73d0db4b21fe4b4120f9211c6243e15f9118.zip |
handle {relative, absolute} symlinks in binaries to be dispatched
-rwxr-xr-x | mkmultiarch | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/mkmultiarch b/mkmultiarch index 6029f6e..8ffaf4b 100755 --- a/mkmultiarch +++ b/mkmultiarch @@ -21,12 +21,32 @@ function error() { exit 1 } +# read link on one level only +function read_link_1() { + perl -e 'print readlink(shift)' $1 +} + function dispatch_binaries() { local file=$1 local bindir=`dirname $file` local archbindir=$bindir/$mplat [[ -d $archbindir ]] || mkdir -p $archbindir - mv $file $archbindir/ + if [[ -L $file ]]; then + link=`read_link_1 $file` + case $link in + /*) + mv $file $archbindir/ + ;; + ../*) + ln -s ../$link $archbindir/${file##*/} + rm -f $file + ;; + esac + elif [[ -f $file ]]; then + mv $file $archbindir/ + else + error "Unsupported file type for $file" + fi ln -s /usr/bin/multiarch-dispatch $file } |