Skip to content

Instantly share code, notes, and snippets.

@polyfloyd
Created August 21, 2017 12:34
Show Gist options
  • Select an option

  • Save polyfloyd/93e07c7df18287753bb24ed6e75b21a9 to your computer and use it in GitHub Desktop.

Select an option

Save polyfloyd/93e07c7df18287753bb24ed6e75b21a9 to your computer and use it in GitHub Desktop.
Gitea Updater
#!/bin/bash
# Downloads a binary file from the internetz and makes it executable. What could possibly go wrong? :D
INSTALL="/opt/gitea"
set -eu
set -o pipefail
path=$(curl -sL https://github.com/go-gitea/gitea/releases/latest | sed -n 's/.*<a href="\([^"]\+linux-amd64\)".*$/\1/p')
ofile=$INSTALL/$(basename "$path")
if [ ! -e "$ofile" ]; then
wget "https://github.com/$path" -o /dev/null -O "$ofile"
chmod 755 "$ofile"
ln -sf "$ofile" "$INSTALL/gitea"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment