Skip to content

Instantly share code, notes, and snippets.

@kokamkarsahil
Last active May 26, 2023 03:30
Show Gist options
  • Save kokamkarsahil/bc1ac4938f113fb4246613e4e9bf5501 to your computer and use it in GitHub Desktop.
Save kokamkarsahil/bc1ac4938f113fb4246613e4e9bf5501 to your computer and use it in GitHub Desktop.
Notation Install Script Working Demo
#!/bin/bash
NOTATION_VERSION=1.0.0-rc.5
arch=$(uname -m)
BASE_URL=https://github.com/notaryproject/notation/releases/download
<<TODO
- check_if_noation_installed
- use_wget
- handle_if_curl_not_installed
- handle_install_without_sudo
- checksum_check
- cleanup-download
- Ability to choice Noation version to download
TODO
download_linux() {
if [[ "$arch" == "x86_64" ]]; then
curl -LO $BASE_URL/v$NOTATION_VERSION/notation_$NOTATION_VERSION\_linux_amd64.tar.gz
tar xvzf notation\_$NOTATION_VERSION\_linux_amd64.tar.gz -C /usr/local/bin/ notation
echo "Notation v${NOTATION_VERSION} is successfuly installed"
elif [[ "$arch" == "arm" ]]; then
curl -LO $BASE_URL/v$NOTATION_VERSION/notation_$NOTATION_VERSION\_linux_arm64.tar.gz
tar xvzf notation\_$NOTATION_VERSION\_linux_arm64.tar.gz -C /usr/local/bin/ notation
echo "Notation v${NOTATION_VERSION} is successfuly installed"
else
echo "Sorry ${arch} Architecture is currently unsupported"
fi
}
download_mac() {
if [[ "$arch" == "x86_64" ]]; then
curl -LO $BASE_URL/v$NOTATION_VERSION/notation_$NOTATION_VERSION\_darwin_amd64.tar.gz
tar xvzf notation\_$NOTATION_VERSION\_darwin_amd64.tar.gz -C /usr/local/bin/ notation
echo "Notation v${NOTATION_VERSION} is successfuly installed"
elif [[ "$arch" == "arm" ]]; then
curl -LO $BASE_URL/v$NOTATION_VERSION/notation_$NOTATION_VERSION\_darwin_arm64.tar.gz
tar xvzf notation\_$NOTATION_VERSION\_darwin_arm64.tar.gz -C /usr/local/bin/ notation
echo "Notation v${NOTATION_VERSION} is successfuly installed"
else
echo "Sorry ${arch} Architecture is currently unsupported"
fi
}
if [[ "$OSTYPE" == "darwin"* ]]; then
download_mac;
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
download_linux;
elif [[ "$OSTYPE" == "win32" ]]; then
echo "Please download using wget or exe"
else
echo "${OSTYPE} is currently unsupported"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment