diff options
Diffstat (limited to 'meta/files/toolchain-shar-relocate.sh')
-rw-r--r-- | meta/files/toolchain-shar-relocate.sh | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh index 5433741296..b017714df0 100644 --- a/meta/files/toolchain-shar-relocate.sh +++ b/meta/files/toolchain-shar-relocate.sh | |||
@@ -1,11 +1,14 @@ | |||
1 | if ! xargs --version > /dev/null 2>&1; then | 1 | for cmd in xargs file; do |
2 | echo "xargs is required by the relocation script, please install it first. Abort!" | 2 | if ! command -v $cmd > /dev/null 2>&1; then |
3 | exit 1 | 3 | echo "The command '$cmd' is required by the relocation script, please install it first. Abort!" |
4 | fi | 4 | exit 1 |
5 | fi | ||
6 | done | ||
5 | 7 | ||
6 | # fix dynamic loader paths in all ELF SDK binaries | 8 | # fix dynamic loader paths in all ELF SDK binaries |
9 | # allow symlinks to be accessed via the find command too | ||
7 | native_sysroot=$($SUDO_EXEC cat $env_setup_script |grep 'OECORE_NATIVE_SYSROOT='|cut -d'=' -f2|tr -d '"') | 10 | native_sysroot=$($SUDO_EXEC cat $env_setup_script |grep 'OECORE_NATIVE_SYSROOT='|cut -d'=' -f2|tr -d '"') |
8 | dl_path=$($SUDO_EXEC find $native_sysroot/lib -name "ld-linux*") | 11 | dl_path=$($SUDO_EXEC find $native_sysroot/lib/ -maxdepth 1 -name "ld-linux*") |
9 | if [ "$dl_path" = "" ] ; then | 12 | if [ "$dl_path" = "" ] ; then |
10 | echo "SDK could not be set up. Relocate script unable to find ld-linux.so. Abort!" | 13 | echo "SDK could not be set up. Relocate script unable to find ld-linux.so. Abort!" |
11 | exit 1 | 14 | exit 1 |
@@ -61,7 +64,7 @@ done | xargs -n100 file | grep ":.*\(ASCII\|script\|source\).*text" | \ | |||
61 | -e "$target_sdk_dir/post-relocate-setup" \ | 64 | -e "$target_sdk_dir/post-relocate-setup" \ |
62 | -e "$target_sdk_dir/${0##*/}" | \ | 65 | -e "$target_sdk_dir/${0##*/}" | \ |
63 | xargs -n100 $SUDO_EXEC sed -i \ | 66 | xargs -n100 $SUDO_EXEC sed -i \ |
64 | -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:g" \ | 67 | -e "s:$SDK_BUILD_PATH:$target_sdk_dir:g" \ |
65 | -e "s:^#! */usr/bin/perl.*:#! /usr/bin/env perl:g" \ | 68 | -e "s:^#! */usr/bin/perl.*:#! /usr/bin/env perl:g" \ |
66 | -e "s: /usr/bin/perl: /usr/bin/env perl:g" | 69 | -e "s: /usr/bin/perl: /usr/bin/env perl:g" |
67 | 70 | ||
@@ -72,7 +75,7 @@ fi | |||
72 | 75 | ||
73 | # change all symlinks pointing to @SDKPATH@ | 76 | # change all symlinks pointing to @SDKPATH@ |
74 | for l in $($SUDO_EXEC find $native_sysroot -type l); do | 77 | for l in $($SUDO_EXEC find $native_sysroot -type l); do |
75 | $SUDO_EXEC ln -sfn $(readlink $l|$SUDO_EXEC sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:") $l | 78 | $SUDO_EXEC ln -sfn $(readlink $l|$SUDO_EXEC sed -e "s:$SDK_BUILD_PATH:$target_sdk_dir:") $l |
76 | if [ $? -ne 0 ]; then | 79 | if [ $? -ne 0 ]; then |
77 | echo "Failed to setup symlinks. Relocate script failed. Abort!" | 80 | echo "Failed to setup symlinks. Relocate script failed. Abort!" |
78 | exit 1 | 81 | exit 1 |