Skip to content

Instantly share code, notes, and snippets.

@Psychokiller1888
Last active January 14, 2022 12:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Psychokiller1888/a9826f92c5a3c5d03f34d182fda1ce4c to your computer and use it in GitHub Desktop.
Save Psychokiller1888/a9826f92c5a3c5d03f34d182fda1ce4c to your computer and use it in GitHub Desktop.
Download the latest version of Hermes Led Control
#!/usr/bin/env bash
if [[ "$EUID" -ne 0 ]]
then echo "Please run as root"
exit
fi
apt-get install git
if [[ -z "$1" ]]; then
echo "No version supplied"
latest=$(curl --silent "https://api.github.com/repos/project-alice-assistant/HermesLedControl/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
echo "Will download $latest"
VERSION=$latest
else
VERSION=$1
echo "Supplied version $VERSION"
fi
dest="/home/$(logname)/HermesLedControl"
rm -rf "$dest"
git clone https://github.com/project-alice-assistant/HermesLedControl.git "$dest"
cd "$dest" || exit
git fetch
git checkout "$VERSION"
git pull
chown -R "$(logname)" "$dest"
chmod +x install.sh
./install.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment