summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorAndrey Mozzhuhin <amozzhuhin@yandex.ru>2021-01-16 11:18:41 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-01-17 11:28:13 +0000
commitfecba74915afb3e9a427e1e829e31680bee70832 (patch)
tree76cda381ccf7f179b4d768bb0d168c4860144b3d /meta
parentd068fbcde2c5dd159ab903e9696ef900514ce866 (diff)
downloadpoky-fecba74915afb3e9a427e1e829e31680bee70832.tar.gz
toolchain-shar-extract.sh: Handle special characters in script path
Extracting SDK archive may fail if the script is run using a path with special characters such as space or asterisk. This is because the shell interprets such characters after expanding the $0 variable. Added quotes to all uses of the shell variable $0 to fix this. (From OE-Core rev: 0453acbbd45604537090ec7a3295b34309e6eecb) Signed-off-by: Andrey Mozzhuhin <amozzhuhin@yandex.ru> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/files/toolchain-shar-extract.sh12
1 files changed, 6 insertions, 6 deletions
diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index bea6d4189a..dd9342758b 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -95,7 +95,7 @@ while getopts ":yd:npDRSl" OPT; do
95 listcontents=1 95 listcontents=1
96 ;; 96 ;;
97 *) 97 *)
98 echo "Usage: $(basename $0) [-y] [-d <dir>]" 98 echo "Usage: $(basename "$0") [-y] [-d <dir>]"
99 echo " -y Automatic yes to all prompts" 99 echo " -y Automatic yes to all prompts"
100 echo " -d <dir> Install the SDK to <dir>" 100 echo " -d <dir> Install the SDK to <dir>"
101 echo "======== Extensible SDK only options ============" 101 echo "======== Extensible SDK only options ============"
@@ -111,17 +111,17 @@ while getopts ":yd:npDRSl" OPT; do
111 esac 111 esac
112done 112done
113 113
114payload_offset=$(($(grep -na -m1 "^MARKER:$" $0|cut -d':' -f1) + 1)) 114payload_offset=$(($(grep -na -m1 "^MARKER:$" "$0"|cut -d':' -f1) + 1))
115if [ "$listcontents" = "1" ] ; then 115if [ "$listcontents" = "1" ] ; then
116 if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then 116 if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
117 tail -n +$payload_offset $0 > sdk.zip 117 tail -n +$payload_offset "$0" > sdk.zip
118 if unzip -l sdk.zip;then 118 if unzip -l sdk.zip;then
119 rm sdk.zip 119 rm sdk.zip
120 else 120 else
121 rm sdk.zip && exit 1 121 rm sdk.zip && exit 1
122 fi 122 fi
123 else 123 else
124 tail -n +$payload_offset $0| tar tvJ || exit 1 124 tail -n +$payload_offset "$0"| tar tvJ || exit 1
125 fi 125 fi
126 exit 126 exit
127fi 127fi
@@ -242,14 +242,14 @@ fi
242 242
243printf "Extracting SDK..." 243printf "Extracting SDK..."
244if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then 244if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
245 tail -n +$payload_offset $0 > sdk.zip 245 tail -n +$payload_offset "$0" > sdk.zip
246 if $SUDO_EXEC unzip $EXTRA_TAR_OPTIONS sdk.zip -d $target_sdk_dir;then 246 if $SUDO_EXEC unzip $EXTRA_TAR_OPTIONS sdk.zip -d $target_sdk_dir;then
247 rm sdk.zip 247 rm sdk.zip
248 else 248 else
249 rm sdk.zip && exit 1 249 rm sdk.zip && exit 1
250 fi 250 fi
251else 251else
252 tail -n +$payload_offset $0| $SUDO_EXEC tar mxJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1 252 tail -n +$payload_offset "$0"| $SUDO_EXEC tar mxJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1
253fi 253fi
254echo "done" 254echo "done"
255 255