diff options
Diffstat (limited to 'meta/files')
-rw-r--r-- | meta/files/toolchain-shar-relocate.sh | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh index d4bcf0e55d..e491153fc5 100644 --- a/meta/files/toolchain-shar-relocate.sh +++ b/meta/files/toolchain-shar-relocate.sh | |||
@@ -1,3 +1,8 @@ | |||
1 | if ! xargs --version > /dev/null 2>&1; then | ||
2 | echo "xargs is required by the relocation script, please install it firts. Abort!" | ||
3 | exit 1 | ||
4 | fi | ||
5 | |||
1 | # fix dynamic loader paths in all ELF SDK binaries | 6 | # fix dynamic loader paths in all ELF SDK binaries |
2 | native_sysroot=$($SUDO_EXEC cat $env_setup_script |grep 'OECORE_NATIVE_SYSROOT='|cut -d'=' -f2|tr -d '"') | 7 | native_sysroot=$($SUDO_EXEC cat $env_setup_script |grep 'OECORE_NATIVE_SYSROOT='|cut -d'=' -f2|tr -d '"') |
3 | dl_path=$($SUDO_EXEC find $native_sysroot/lib -name "ld-linux*") | 8 | dl_path=$($SUDO_EXEC find $native_sysroot/lib -name "ld-linux*") |
@@ -7,6 +12,10 @@ if [ "$dl_path" = "" ] ; then | |||
7 | fi | 12 | fi |
8 | executable_files=$($SUDO_EXEC find $native_sysroot -type f \ | 13 | executable_files=$($SUDO_EXEC find $native_sysroot -type f \ |
9 | \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -printf "'%h/%f' ") | 14 | \( -perm -0100 -o -perm -0010 -o -perm -0001 \) -printf "'%h/%f' ") |
15 | if [ "x$executable_files" = "x" ]; then | ||
16 | echo "SDK relocate failed, could not get executalbe files" | ||
17 | exit 1 | ||
18 | fi | ||
10 | 19 | ||
11 | tdir=`mktemp -d` | 20 | tdir=`mktemp -d` |
12 | if [ x$tdir = x ] ; then | 21 | if [ x$tdir = x ] ; then |
@@ -14,7 +23,7 @@ if [ x$tdir = x ] ; then | |||
14 | exit 1 | 23 | exit 1 |
15 | fi | 24 | fi |
16 | cat <<EOF >> $tdir/relocate_sdk.sh | 25 | cat <<EOF >> $tdir/relocate_sdk.sh |
17 | #!/bin/bash | 26 | #!/bin/sh |
18 | for py in python python2 python3 | 27 | for py in python python2 python3 |
19 | do | 28 | do |
20 | PYTHON=\`which \${py} 2>/dev/null\` | 29 | PYTHON=\`which \${py} 2>/dev/null\` |
@@ -53,9 +62,18 @@ done | xargs -n100 file | grep ":.*\(ASCII\|script\|source\).*text" | \ | |||
53 | -e "s:^#! */usr/bin/perl.*:#! /usr/bin/env perl:g" \ | 62 | -e "s:^#! */usr/bin/perl.*:#! /usr/bin/env perl:g" \ |
54 | -e "s: /usr/bin/perl: /usr/bin/env perl:g" | 63 | -e "s: /usr/bin/perl: /usr/bin/env perl:g" |
55 | 64 | ||
65 | if [ $? -ne 0 ]; then | ||
66 | echo "Failed to replace perl. Relocate script failed. Abort!" | ||
67 | exit 1 | ||
68 | fi | ||
69 | |||
56 | # change all symlinks pointing to @SDKPATH@ | 70 | # change all symlinks pointing to @SDKPATH@ |
57 | for l in $($SUDO_EXEC find $native_sysroot -type l); do | 71 | for l in $($SUDO_EXEC find $native_sysroot -type l); do |
58 | $SUDO_EXEC ln -sfn $(readlink $l|$SUDO_EXEC sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:") $l | 72 | $SUDO_EXEC ln -sfn $(readlink $l|$SUDO_EXEC sed -e "s:$DEFAULT_INSTALL_DIR:$target_sdk_dir:") $l |
73 | if [ $? -ne 0 ]; then | ||
74 | echo "Failed to setup symlinks. Relocate script failed. Abort!" | ||
75 | exit 1 | ||
76 | fi | ||
59 | done | 77 | done |
60 | 78 | ||
61 | echo done | 79 | echo done |