summaryrefslogtreecommitdiff
path: root/precise-armhf-nano-dev/customization/hooks/90-change-symlinks-to-relative.binary
blob: ec2a448388f4f8e8561dcf6fc2f53c7ed5f43661 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh  

# Taken from http://bazaar.launchpad.net/~linaro-toolchain-dev/crosstool-ng/linaro/view/head:/contrib/linaro/make-sysroot.sh

sysroot=binary/boot/filesystem.dir

# Some packages include absolute links in sysroot/usr/lib.
# Convert to relative links instead
for lib in $( find $sysroot -type l ); do
    target=$( readlink $lib )
    base=$( basename $target )

    case $target in
        /*)
            v=$( echo $lib | sed -r "s#^$sysroot/##" | tr -cd / | sed "s#/#../#g" )
            p=$( echo $target | sed "s#^/##" )
            rm $lib
            ln -s $v$p $lib
            ;;
        *)  ;;
    esac
done