From fe09e7d494fee0be71428a047d03b02b5be7dd21 Mon Sep 17 00:00:00 2001 From: Richael Zhuang Date: Mon, 25 Oct 2021 16:59:36 +0800 Subject: [PATCH] scripts/pkgdep: support shfmt for arm64 Get shfmt package according to arch. Change-Id: Ib51feb64368e1ef559c886d9899dd7a1f28cff95 Signed-off-by: Richael Zhuang Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9996 Tested-by: SPDK CI Jenkins Reviewed-by: Michal Berger Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- scripts/pkgdep/common.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/scripts/pkgdep/common.sh b/scripts/pkgdep/common.sh index 739d02ce8..2c4f05470 100755 --- a/scripts/pkgdep/common.sh +++ b/scripts/pkgdep/common.sh @@ -25,17 +25,28 @@ install_shfmt() { local shfmt_dir_out=${SHFMT_DIR_OUT:-/usr/bin} local shfmt_url local os + local arch if hash "$shfmt" && [[ $("$shfmt" --version) == "v$shfmt_version" ]]; then echo "$shfmt already installed" return 0 fi 2> /dev/null + arch=$(uname -m) os=$(uname -s) + case "$arch" in + x86_64) arch="amd64" ;; + aarch64) arch="arm" ;; + *) + echo "Not supported arch (${arch:-Unknown}), skipping" + return 0 + ;; + esac + case "$os" in - Linux) shfmt_url=https://github.com/mvdan/sh/releases/download/v$shfmt_version/shfmt_v${shfmt_version}_linux_amd64 ;; - FreeBSD) shfmt_url=https://github.com/mvdan/sh/releases/download/v$shfmt_version/shfmt_v${shfmt_version}_freebsd_amd64 ;; + Linux) shfmt_url=https://github.com/mvdan/sh/releases/download/v$shfmt_version/shfmt_v${shfmt_version}_linux_${arch} ;; + FreeBSD) shfmt_url=https://github.com/mvdan/sh/releases/download/v$shfmt_version/shfmt_v${shfmt_version}_freebsd_${arch} ;; *) echo "Not supported OS (${os:-Unknown}), skipping" return 0