Skip to content

Instantly share code, notes, and snippets.

@mattstein
Created December 16, 2018 05:02
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 mattstein/66c5bfb372540b2c63efac2dcb95f3d9 to your computer and use it in GitHub Desktop.
Save mattstein/66c5bfb372540b2c63efac2dcb95f3d9 to your computer and use it in GitHub Desktop.
Shell script for updating fathom analytics binary on Centmin Mod linux.
#!/bin/bash
CUR_VERSION="$(fathom version | cut -d' ' -f3)"
NEW_VERSION="$(curl -s https://api.github.com/repos/usefathom/fathom/releases/latest | grep tag_name | cut -d'v' -f2 | cut -d'"' -f1)"
echo "Current Version: $CUR_VERSION => New Version: $NEW_VERSION"
if [ "$NEW_VERSION" != "$CUR_VERSION" ]; then
echo "Installing version ${NEW_VERSION}..."
download_url="https://github.com/usefathom/fathom/releases/download/v${NEW_VERSION}/fathom_${NEW_VERSION}_linux_amd64.tar.gz"
echo "→ downloading ${download_url}..."
wget $download_url
tarball="$(find . -name "*_linux_amd64.tar.gz" 2>/dev/null)"
echo "→ extracting ${tarball}..."
tar -xzf $tarball
chmod +x fathom
sudo mv fathom /usr/local/bin/
location="$(which fathom)"
echo "- installed at $location"
echo ""
fathom version
sudo service fathom restart
rm $tarball
rm LICENSE
rm README.md
else
echo Latest version already installed
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment