mirror of
https://git.yoctoproject.org/poky
synced 2026-09-19 00:49:33 +02:00
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: 84bdeabd40183006d136f0ae416efa5f71e3557b) Signed-off-by: Andrey Mozzhuhin <amozzhuhin@yandex.ru> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 0453acbbd45604537090ec7a3295b34309e6eecb) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
809ca20ce1
commit
b0af7fd0e7
@@ -95,7 +95,7 @@ while getopts ":yd:npDRSl" OPT; do
|
|||||||
listcontents=1
|
listcontents=1
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Usage: $(basename $0) [-y] [-d <dir>]"
|
echo "Usage: $(basename "$0") [-y] [-d <dir>]"
|
||||||
echo " -y Automatic yes to all prompts"
|
echo " -y Automatic yes to all prompts"
|
||||||
echo " -d <dir> Install the SDK to <dir>"
|
echo " -d <dir> Install the SDK to <dir>"
|
||||||
echo "======== Extensible SDK only options ============"
|
echo "======== Extensible SDK only options ============"
|
||||||
@@ -111,17 +111,17 @@ while getopts ":yd:npDRSl" OPT; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
payload_offset=$(($(grep -na -m1 "^MARKER:$" $0|cut -d':' -f1) + 1))
|
payload_offset=$(($(grep -na -m1 "^MARKER:$" "$0"|cut -d':' -f1) + 1))
|
||||||
if [ "$listcontents" = "1" ] ; then
|
if [ "$listcontents" = "1" ] ; then
|
||||||
if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
|
if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
|
||||||
tail -n +$payload_offset $0 > sdk.zip
|
tail -n +$payload_offset "$0" > sdk.zip
|
||||||
if unzip -l sdk.zip;then
|
if unzip -l sdk.zip;then
|
||||||
rm sdk.zip
|
rm sdk.zip
|
||||||
else
|
else
|
||||||
rm sdk.zip && exit 1
|
rm sdk.zip && exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
tail -n +$payload_offset $0| tar tvJ || exit 1
|
tail -n +$payload_offset "$0"| tar tvJ || exit 1
|
||||||
fi
|
fi
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
@@ -242,14 +242,14 @@ fi
|
|||||||
|
|
||||||
printf "Extracting SDK..."
|
printf "Extracting SDK..."
|
||||||
if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
|
if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
|
||||||
tail -n +$payload_offset $0 > sdk.zip
|
tail -n +$payload_offset "$0" > sdk.zip
|
||||||
if $SUDO_EXEC unzip $EXTRA_TAR_OPTIONS sdk.zip -d $target_sdk_dir;then
|
if $SUDO_EXEC unzip $EXTRA_TAR_OPTIONS sdk.zip -d $target_sdk_dir;then
|
||||||
rm sdk.zip
|
rm sdk.zip
|
||||||
else
|
else
|
||||||
rm sdk.zip && exit 1
|
rm sdk.zip && exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
tail -n +$payload_offset $0| $SUDO_EXEC tar mxJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1
|
tail -n +$payload_offset "$0"| $SUDO_EXEC tar mxJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1
|
||||||
fi
|
fi
|
||||||
echo "done"
|
echo "done"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user