Skip to content

Instantly share code, notes, and snippets.

@Nixes
Last active May 6, 2018 02:45
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 Nixes/c89c59a30e77edbd219d766ee9be30b9 to your computer and use it in GitHub Desktop.
Save Nixes/c89c59a30e77edbd219d766ee9be30b9 to your computer and use it in GitHub Desktop.
Update gogs server, requires all paths to be set to gogs-data folder
echo "Downloading update"
curl -s -L https://github.com/gogits/gogs/releases/latest | egrep -o '/gogits/gogs/releases/download/[v][0-9\.]*\/raspi2_armv6.zip' | wget --base=http://github.com/ -i - -O gogs-latest.zip
echo "Stopping gogs service"
sudo service gogs stop
echo "Starting backup"
today=`date +%Y-%m-%d.%H:%M:%S`
zip -r gogs-backup-$today.zip gogs gogs-data
echo "Moving config to tmp directory"
cp -r gogs/custom gogs-custom-tmp
echo "Deleting original gogs folder"
rm -r gogs
echo "Unzip Update"
unzip gogs-latest.zip
echo "Copy config back to fresh folder"
cp -r gogs-custom-tmp gogs/custom
echo "Cleaning up temporary files"
rm -r gogs-custom-tmp gogs-latest.zip
echo "Starting up gogs service"
sudo service gogs start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment