diff --git a/scripts/helm-docs.sh b/scripts/helm-docs.sh index 09177cd0..6baa9bcb 100755 --- a/scripts/helm-docs.sh +++ b/scripts/helm-docs.sh @@ -7,42 +7,23 @@ helmdocsv=1.7.0 bindir=$( cd "${0%/*}" && pwd ) # Change to script dir and set bin dir to this targetbin=$( cd "$bindir"/.. && pwd )/target/bin helmdocsbin=$targetbin/helm-docs-$helmdocsv -os="" -arch="" if [ ! -f "$helmdocsbin" ]; then - case $(uname | tr '[:upper:]' '[:lower:]') in - darwin*) - os=darwin - arch=x86_64 - ;; - linux*) - os=linux - case $(uname -m) in - x86_64) arch=x86_64 ;; - amd64) arch=amd64 ;; - arm) - tmp=$(dpkg --print-architecture) - if echo "$tmp" | grep -q arm64; then - arch=arm64 - elif echo "$tmp" | grep -q armv7; then - arch=armv7 - elif echo "$tmp" | grep -q armv6; then - arch=armv6 - fi - ;; - esac - ;; - msys*) - os=windows - arch=x86_64 - ;; + # Release assets are named helm-docs___.tar.gz, + # e.g. Darwin_arm64, Linux_x86_64, Windows_x86_64 + case $(uname -s) in + Darwin) os=Darwin ;; + Linux) os=Linux ;; + MSYS*|MINGW*|CYGWIN*) os=Windows ;; + *) echo "Unsupported OS: $(uname -s)"; exit 126 ;; + esac + case $(uname -m) in + x86_64|amd64) arch=x86_64 ;; + aarch64|arm64) arch=arm64 ;; + armv7l) arch=armv7 ;; + armv6l) arch=armv6 ;; + *) echo "Unsupported architecture: $(uname -m)"; exit 126 ;; esac - - if [ -z "$os" ]; then - echo "Couldn't find a matching binary" - exit 126 - fi helmdocscurl="https://github.com/norwoodj/helm-docs/releases/download/v$helmdocsv/helm-docs_${helmdocsv}_${os}_${arch}.tar.gz" tmp=$(mktemp -d -t helm-docs.XXX) mkdir -p "$targetbin"