summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmkmultiarch22
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
}