document update script

This commit is contained in:
Matthias Kretschmann 2018-12-15 19:43:29 +01:00
parent b8a3de6445
commit fa6c3b8bb2
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 42 additions and 10 deletions

View File

@ -5,6 +5,7 @@
> Gitea installation notes [git.berlin](https://git.berlin)
- [Migration from GitLab](#migration-from-gitlab)
- [Update Gitea](#update-gitea)
- [Customization](#customization)
- [Handy commands](#handy-commands)
- [Gitea Documentation](#gitea-documentation)
@ -13,7 +14,24 @@
## Migration from GitLab
- [`migrate-gitlab-gitea.sh`](migrate-gitlab-gitea.sh)
- [`bin/migrate-gitlab-gitea.sh`](bin/migrate-gitlab-gitea.sh)
## Update Gitea
- [`bin/update-gitea.sh`](bin/update-gitea.sh)
Update script sets options by default, can be changed at top of script:
- `giteaBinary`: Gitea binary under `/home/git/gitea/gitea`
- `arch`: architecture is `linux-amd64`
- `giteaUpdateStorage`: downloaded files will be stored in `/home/git/gitea-update`
- `giteaUser`: linux user Gitea is running under, `git`
- `giteaGroup`: linux group Gitea is running under, `git`
```bash
# run update script with sudo, passing version number as option
sudo ./bin/update-gitea.sh 1.6.1
```
## Customization

View File

@ -1,12 +1,7 @@
#!/bin/sh
#
# usage, run as user git:
#
# sudo service gitea stop
# ./update-gitea.sh 1.6.1
# sudo service gitea start
#
# su -c "./update-gitea.sh 1.6.1" -s /bin/sh git
# usage, run with sudo:
# sudo ./update-gitea.sh 1.6.1
#
set -e
@ -14,10 +9,29 @@ set -e
version=$1
arch="linux-amd64"
giteaBinary="/home/git/gitea/gitea"
giteaUpdateStorage="/home/git/gitea-update"
giteaUser="git"
giteaGroup="git"
cd /home/git/gitea-update
# stop Gitea
sudo service gitea stop
echo "Stopped Gitea."
# download new binary
cd $giteaUpdateStorage
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
cp "gitea-${version}-${arch}" $giteaBinary
chmod +x $giteaBinary
echo "Updated Gitea binary v${version}."
# set permissions
chown $giteaUser:$giteaGroup $giteaBinary
chmod +x $giteaBinary
echo "Set permissions."
# start Gitea
sudo service gitea start
echo "Restarted Gitea. Update done."