helm.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env -S bash +e
  2. temp="/tmp/rook-tests-scripts-helm"
  3. helm_version="${HELM_VERSION:-"v3.8.0"}"
  4. arch="${ARCH:-}"
  5. detectArch() {
  6. case "$(uname -m)" in
  7. "x86_64" | "amd64")
  8. arch="amd64"
  9. ;;
  10. "aarch64")
  11. arch="arm64"
  12. ;;
  13. "i386")
  14. arch="i386"
  15. ;;
  16. *)
  17. echo "Couldn't translate 'uname -m' output to an available arch."
  18. echo "Try setting ARCH environment variable to your system arch:"
  19. echo "amd64, x86_64. aarch64, i386"
  20. exit 1
  21. ;;
  22. esac
  23. }
  24. install() {
  25. # Download and unpack helm
  26. local dist
  27. dist="$(uname -s)"
  28. dist=$(echo "${dist}" | tr "[:upper:]" "[:lower:]")
  29. mkdir -p "${temp}"
  30. wget "https://get.helm.sh/helm-${helm_version}-${dist}-${arch}.tar.gz" -O "${temp}/helm.tar.gz"
  31. tar -C "${temp}" -xvf "${temp}/helm.tar.gz" --strip-components 1
  32. }
  33. if [ -z "${arch}" ]; then
  34. detectArch
  35. fi
  36. case "${1:-}" in
  37. up)
  38. install
  39. ;;
  40. *)
  41. echo "usage:" >&2
  42. echo " $0 up" >&2
  43. echo " $0 clean" >&2
  44. esac