summaryrefslogtreecommitdiff
path: root/meta/files
diff options
context:
space:
mode:
Diffstat (limited to 'meta/files')
-rw-r--r--meta/files/toolchain-shar-relocate.sh19
1 files changed, 17 insertions, 2 deletions
diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh
index 4ef2927171..4f34fb4bfb 100644
--- a/meta/files/toolchain-shar-relocate.sh
+++ b/meta/files/toolchain-shar-relocate.sh
@@ -13,8 +13,23 @@ if [ x$tdir = x ] ; then
echo "SDK relocate failed, could not create a temporary directory"
exit 1
fi
-echo "#!/bin/bash" > $tdir/relocate_sdk.sh
-echo exec ${env_setup_script%/*}/relocate_sdk.py $target_sdk_dir $dl_path $executable_files >> $tdir/relocate_sdk.sh
+cat <<EOF >> $tdir/relocate_sdk.sh
+#!/bin/bash
+for py in python python2 python3
+do
+ PYTHON=\`which \${py} 2>/dev/null\`
+ if [ \$? -eq 0 ]; then
+ break;
+ fi
+done
+
+if [ x\${PYTHON} = "x" ]; then
+ echo "SDK could not be relocated. No python found."
+ exit 1
+fi
+\${PYTHON} ${env_setup_script%/*}/relocate_sdk.py $target_sdk_dir $dl_path $executable_files
+EOF
+
$SUDO_EXEC mv $tdir/relocate_sdk.sh ${env_setup_script%/*}/relocate_sdk.sh
$SUDO_EXEC chmod 755 ${env_setup_script%/*}/relocate_sdk.sh
rm -rf $tdir