diff options
Diffstat (limited to 'external/poky/meta/files/toolchain-shar-extract.sh')
-rw-r--r-- | external/poky/meta/files/toolchain-shar-extract.sh | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/external/poky/meta/files/toolchain-shar-extract.sh b/external/poky/meta/files/toolchain-shar-extract.sh index 9eabd626..04527f89 100644 --- a/external/poky/meta/files/toolchain-shar-extract.sh +++ b/external/poky/meta/files/toolchain-shar-extract.sh @@ -1,13 +1,13 @@ #!/bin/sh -[ -z "$ENVCLEANED" ] && exec /usr/bin/env -i ENVCLEANED=1 HOME="$HOME" \ - LC_ALL=en_US.UTF-8 \ - TERM=$TERM \ - ICECC_PATH="$ICECC_PATH" \ - http_proxy="$http_proxy" https_proxy="$https_proxy" ftp_proxy="$ftp_proxy" \ - no_proxy="$no_proxy" all_proxy="$all_proxy" GIT_PROXY_COMMAND="$GIT_PROXY_COMMAND" "$0" "$@" -[ -f /etc/environment ] && . /etc/environment -export PATH=`echo "$PATH" | sed -e 's/:\.//' -e 's/::/:/'` +export LC_ALL=en_US.UTF-8 +#Make sure at least one python is installed +INIT_PYTHON=$(which python3 2>/dev/null ) +[ -z "$INIT_PYTHON" ] && INIT_PYTHON=$(which python2 2>/dev/null) +[ -z "$INIT_PYTHON" ] && echo "Error: The SDK needs a python installed" && exit 1 + +# Remove invalid PATH elements first (maybe from a previously setup toolchain now deleted +PATH=`$INIT_PYTHON -c 'import os; print(":".join(e for e in os.environ["PATH"].split(":") if os.path.exists(e)))'` tweakpath () { case ":${PATH}:" in @@ -113,7 +113,16 @@ done payload_offset=$(($(grep -na -m1 "^MARKER:$" $0|cut -d':' -f1) + 1)) if [ "$listcontents" = "1" ] ; then - tail -n +$payload_offset $0| tar tvJ || exit 1 + if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then + tail -n +$payload_offset $0 > sdk.zip + if unzip -l sdk.zip;then + rm sdk.zip + else + rm sdk.zip && exit 1 + fi + else + tail -n +$payload_offset $0| tar tvJ || exit 1 + fi exit fi @@ -185,11 +194,11 @@ fi if [ -e "$target_sdk_dir/environment-setup-@REAL_MULTIMACH_TARGET_SYS@" ]; then echo "The directory \"$target_sdk_dir\" already contains a SDK for this architecture." - printf "If you continue, existing files will be overwritten! Proceed[y/N]? " + printf "If you continue, existing files will be overwritten! Proceed [y/N]? " default_answer="n" else - printf "You are about to install the SDK to \"$target_sdk_dir\". Proceed[Y/n]? " + printf "You are about to install the SDK to \"$target_sdk_dir\". Proceed [Y/n]? " default_answer="y" fi @@ -232,7 +241,16 @@ if [ ! -x $target_sdk_dir -o ! -w $target_sdk_dir -o ! -r $target_sdk_dir ]; the fi printf "Extracting SDK..." -tail -n +$payload_offset $0| $SUDO_EXEC tar xJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1 +if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then + tail -n +$payload_offset $0 > sdk.zip + if $SUDO_EXEC unzip $EXTRA_TAR_OPTIONS sdk.zip -d $target_sdk_dir;then + rm sdk.zip + else + rm sdk.zip && exit 1 + fi +else + tail -n +$payload_offset $0| $SUDO_EXEC tar mxJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1 +fi echo "done" printf "Setting it up..." |