Last active
August 3, 2020 16:29
-
-
Save wadey/25ddad6bca690988b151aca8bab84f5a to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
set -e | |
FILE="nebula-$(uname | tr '[:upper:]' '[:lower:]')-amd64.tar.gz" | |
BINDIR="/usr/local/bin" | |
CURRENT="v$($BINDIR/nebula -version | cut -d' ' -f2)" | |
TEMPDIR="$(mktemp -d)" | |
trap 'rm -rf "$TEMPDIR"' exit | |
cd "$TEMPDIR" | |
curl -s "https://api.github.com/repos/NebulaOSS/nebula-nightly/releases/latest" >latest.json | |
LATEST="$(jq -r .tag_name latest.json)" | |
if [ "$CURRENT" = "$LATEST" ] | |
then | |
echo "Already on latest nightly: $LATEST" | |
exit 0 | |
fi | |
echo "Upgrading from $CURRENT -> $LATEST" | |
URL="$(jq -r '.assets[] | select(.name == "'"$FILE"'").browser_download_url' latest.json)" | |
curl -L -o "$FILE" "$URL" | |
tar -zxf "$FILE" | |
sudo mv nebula /usr/local/bin | |
sudo mv nebula-cert /usr/local/bin | |
"$BINDIR/nebula" -version |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment