38 lines
768 B
Bash
Executable File
38 lines
768 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# usage, run with sudo:
|
|
# ./update-gitea.sh 1.6.1
|
|
#
|
|
|
|
set -e
|
|
|
|
version=$1
|
|
arch="linux-amd64"
|
|
giteaBinary="/home/git/gitea/gitea"
|
|
giteaStore="/home/git/gitea-update"
|
|
giteaUser="git"
|
|
giteaGroup="git"
|
|
|
|
# stop Gitea
|
|
sudo service gitea stop
|
|
echo "Stopped Gitea."
|
|
|
|
# download new binary
|
|
cd $giteaStore
|
|
echo "Downloading gitea-${version}-${arch}..."
|
|
|
|
wget -O "gitea-${version}-${arch}" "https://dl.gitea.io/gitea/${version}/gitea-${version}-${arch}"
|
|
|
|
# copy new binary over old one
|
|
sudo cp "gitea-${version}-${arch}" $giteaBinary
|
|
echo "Updated Gitea binary v${version}."
|
|
|
|
# set permissions
|
|
sudo chown $giteaUser:$giteaGroup $giteaBinary
|
|
sudo chmod +x $giteaBinary
|
|
echo "Set permissions."
|
|
|
|
# start Gitea
|
|
sudo service gitea start
|
|
echo "Restarted Gitea. Update done."
|