]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
toolchain-shar-extract.sh: check required tool before extracting SDK
authorMing Liu <liu.ming50@gmail.com>
Sun, 27 Oct 2024 10:43:17 +0000 (11:43 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 28 Oct 2024 11:57:26 +0000 (11:57 +0000)
To extract the SDK archive, the proper tools need to be present on
system, check unzip for zip archive type, check xz for tar.xz archive
type.

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/files/toolchain-shar-extract.sh

index 7e40c673742220a10dfd8edf5bef4a7e290e54d5..8368a8119689f51c2e41053a8da58e9e5bf9b2f5 100644 (file)
@@ -245,6 +245,10 @@ fi
 
 printf "Extracting SDK..."
 if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
+    if [ -z "$(command -v unzip)" ]; then
+        echo "Aborted, unzip is required to extract the SDK archive, please make sure it's installed on your system!"
+        exit 1
+    fi
     tail -n +$payload_offset "$0" > sdk.zip
     if $SUDO_EXEC unzip $EXTRA_TAR_OPTIONS sdk.zip -d $target_sdk_dir;then
         rm sdk.zip
@@ -252,6 +256,10 @@ if [ @SDK_ARCHIVE_TYPE@ = "zip" ]; then
         rm sdk.zip && exit 1
     fi
 else
+    if [ -z "$(command -v xz)" ]; then
+        echo "Aborted, xz is required to extract the SDK archive, please make sure it's installed on your system!"
+        exit 1
+    fi
     tail -n +$payload_offset "$0"| $SUDO_EXEC tar mxJ -C $target_sdk_dir --checkpoint=.2500 $EXTRA_TAR_OPTIONS || exit 1
 fi
 echo "done"