Skip to content

Instantly share code, notes, and snippets.

@diurnalist
Created July 16, 2019 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diurnalist/3c79cc1cd0cef00f1bd352af24e4b7b8 to your computer and use it in GitHub Desktop.
Save diurnalist/3c79cc1cd0cef00f1bd352af24e4b7b8 to your computer and use it in GitHub Desktop.
Easy-install of Chameleon CLI tools (requires auth)
#!/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