git.berlin/bin/update-gitea.sh

38 lines
768 B
Bash
Raw Normal View History

2018-12-12 21:53:02 +01:00
#!/bin/sh
#
2018-12-15 19:43:29 +01:00
# usage, run with sudo:
2020-03-13 17:32:23 +01:00
# ./update-gitea.sh 1.6.1
2018-12-12 21:53:02 +01:00
#
set -e
version=$1
arch="linux-amd64"
giteaBinary="/home/git/gitea/gitea"
2018-12-15 20:09:22 +01:00
giteaStore="/home/git/gitea-update"
2018-12-15 19:43:29 +01:00
giteaUser="git"
giteaGroup="git"
# stop Gitea
sudo service gitea stop
echo "Stopped Gitea."
2018-12-12 21:53:02 +01:00
2018-12-15 19:43:29 +01:00
# download new binary
2018-12-15 20:09:22 +01:00
cd $giteaStore
2018-12-15 19:43:29 +01:00
echo "Downloading gitea-${version}-${arch}..."
2018-12-12 21:53:02 +01:00
wget -O "gitea-${version}-${arch}" "https://dl.gitea.io/gitea/${version}/gitea-${version}-${arch}"
2018-12-15 19:43:29 +01:00
# copy new binary over old one
2020-03-13 17:32:23 +01:00
sudo cp "gitea-${version}-${arch}" $giteaBinary
2018-12-15 19:43:29 +01:00
echo "Updated Gitea binary v${version}."
# set permissions
2020-03-13 17:32:23 +01:00
sudo chown $giteaUser:$giteaGroup $giteaBinary
sudo chmod +x $giteaBinary
2018-12-15 19:43:29 +01:00
echo "Set permissions."
# start Gitea
sudo service gitea start
echo "Restarted Gitea. Update done."