install.sh 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. RELEASE="v2.5.9"
  2. URL="https://github.com/argoproj/argo-cd/releases/download/${RELEASE}/argocd-linux-amd64"
  3. DESIRED_SHA="d1168eac812d939ba29c7723f56163b824f40548"
  4. if [[ "$(shasum $(realpath argocd-linux-amd64) | awk '{print $1}')" == "$DESIRED_SHA" ]] ; then
  5. echo "argocd CLI already up to date"
  6. exit 0
  7. else
  8. echo "Downloading argocd cli tool"
  9. curl -sSL -o argocd-linux-amd64.new ${URL}
  10. fi
  11. ARGO=$(realpath argocd-linux-amd64.new)
  12. CLI=${HOME}/monorepo/tools/bin/argocd
  13. SHASUM=$(shasum ${ARGO} | awk '{print $1}')
  14. if [[ "$SHASUM" == "$DESIRED_SHA" ]]; then
  15. echo "binary 'argocd-linux-amd64.new' matches desired sha"
  16. echo " wanted: $DESIRED_SHA"
  17. echo " have: $SHASUM"
  18. mv $ARGO ${ARGO%.*}
  19. ARGO=$(realpath argocd-linux-amd64)
  20. else
  21. echo "binary 'argocd-linux-amd64.new' does not match desired sha"
  22. echo " wanted: $DESIRED_SHA"
  23. echo " have: $SHASUM"
  24. exit 1
  25. fi
  26. if test -L "$CLI"; then
  27. echo "Symlink exists at ${CLI}"
  28. else
  29. echo "Creating symlink at ${CLI}"
  30. ln -s ${ARGO} ${CLI}
  31. fi
  32. if test -x ${ARGO} ; then
  33. echo "${ARGO} is already executable"
  34. else
  35. echo "Marking ${ARGO} executable"
  36. chmod +x ${ARGO}
  37. fi