Created
July 16, 2019 20:43
-
-
Save diurnalist/3c79cc1cd0cef00f1bd352af24e4b7b8 to your computer and use it in GitHub Desktop.
Easy-install of Chameleon CLI tools (requires auth)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
version="${1:-master}" | |
tmp_dir="$(mktemp -d)" | |
repo="https://github.com/ChameleonCloud/climeleon" | |
install_dir="${CC_INSTALL_PATH:-/usr/local/bin}" | |
cleanup() { | |
rm -rf "$tmp_dir" | |
} | |
trap cleanup EXIT | |
printf "GitHub username: " | |
read username </dev/tty | |
printf "GitHub password (OR Access Token if you're using 2FA): " | |
read -s password </dev/tty | |
echo | |
pushd "$tmp_dir" >/dev/null | |
curl -u "$username:$password" -sL "$repo/archive/$version.tar.gz" \ | |
| tar -xz --strip-components=1 \ | |
|| { | |
echo "Error pulling repository from GitHub. Make sure your username and" | |
echo "password are correct, and that you have access to the repo!" | |
exit 1 | |
} | |
echo "Copying scripts to $install_dir" | |
cp bin/* "$install_dir/" | |
popd >/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment