From 1ded869c82d3b45483ca017102d92d402d99b401 Mon Sep 17 00:00:00 2001 From: Jonathan Schwender Date: Sun, 6 Oct 2024 14:19:42 +0200 Subject: [PATCH] Fix OH 5.0 install Ignore archive name and strip off the first part, so we can ignore the upstream folder name. Signed-off-by: Jonathan Schwender --- install_ohos_sdk.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/install_ohos_sdk.sh b/install_ohos_sdk.sh index c3a3d7e..248cc07 100755 --- a/install_ohos_sdk.sh +++ b/install_ohos_sdk.sh @@ -62,15 +62,20 @@ if [[ "${MIRROR_DOWNLOAD_SUCCESS}" != "true" ]]; then curl --fail -L -O "${DOWNLOAD_URL}.sha256" fi +VERSION_MAJOR=${INPUT_VERSION%%.*} + if [[ "${OS}" == "mac" ]]; then echo "$(cat "${OS_FILENAME}".sha256) ${OS_FILENAME}" | shasum -a 256 --check --status - tar -xf "${OS_FILENAME}" --strip-components=2 + tar -xf "${OS_FILENAME}" --strip-components=3 else echo "$(cat "${OS_FILENAME}".sha256) ${OS_FILENAME}" | sha256sum --check --status - tar -xf "${OS_FILENAME}" + if (( VERSION_MAJOR >= 5 )); then + tar -xf "${OS_FILENAME}" + else + tar -xf "${OS_FILENAME}" --strip-components=1 + fi fi rm "${OS_FILENAME}" "${OS_FILENAME}.sha256" -cd ohos-sdk echo "sdk-path=$PWD" >> "${GITHUB_OUTPUT}" if [[ "${OS}" == "linux" ]]; then