forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: (28 commits) Added auto-save whitespace behavior if it changed manually (go-gitea#15566) Support custom ACME provider (go-gitea#18340) Refactor i18n, use Locale to provide i18n/translation related functions (go-gitea#18648) Only request write when necessary (go-gitea#18657) [skip ci] Updated translations via Crowdin Add separate SSH_USER config option (go-gitea#17584) Be more lenient with label colors (go-gitea#17752) remove redundant call to UpdateRepoStats during migration (go-gitea#18591) more repo dump/restore tests, including pull requests (go-gitea#18621) No longer show the db-downgrade SQL in production (go-gitea#18653) Fix the missing i18n key for update checker (go-gitea#18646) Update gitea-vet (go-gitea#18640) Future proof for 1.18 (go-gitea#18644) Add `contrib/upgrade.sh` (go-gitea#18286) If rendering has failed due to a net.OpError stop rendering (go-gitea#18642) Delete old git.NewCommand() and use it as git.NewCommandContext() (go-gitea#18552) Update JS dependencies (go-gitea#18636) fix commits_list_small.tmpl (go-gitea#18641) Fix `make fmt` and `make fmt-check` (go-gitea#18633) Frontport of changelog for v1.16.1 (go-gitea#18615) ...
- Loading branch information
Showing
169 changed files
with
2,459 additions
and
1,940 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
# This is an update script for gitea installed via the binary distribution | ||
# from dl.gitea.io on linux as systemd service. It performs a backup and updates | ||
# Gitea in place. | ||
# NOTE: This adds the GPG Signing Key of the Gitea maintainers to the keyring. | ||
# Depends on: bash, curl, xz, sha256sum, gpg. optionally jq. | ||
# Usage: [environment vars] upgrade.sh [version] | ||
# See section below for available environment vars. | ||
# When no version is specified, updates to the latest release. | ||
# Examples: | ||
# upgrade.sh 1.15.10 | ||
# giteahome=/opt/gitea giteaconf=$giteahome/app.ini upgrade.sh | ||
|
||
# apply variables from environment | ||
: "${giteabin:="/usr/local/bin/gitea"}" | ||
: "${giteahome:="/var/lib/gitea"}" | ||
: "${giteaconf:="/etc/gitea/app.ini"}" | ||
: "${giteauser:="git"}" | ||
: "${sudocmd:="sudo"}" | ||
: "${arch:="linux-amd64"}" | ||
: "${backupopts:=""}" # see `gitea dump --help` for available options | ||
|
||
function giteacmd { | ||
"$sudocmd" --user "$giteauser" "$giteabin" --config "$giteaconf" --work-path "$giteahome" "$@" | ||
} | ||
|
||
function require { | ||
for exe in "$@"; do | ||
command -v "$exe" &>/dev/null || (echo "missing dependency '$exe'"; exit 1) | ||
done | ||
} | ||
require systemctl curl xz sha256sum gpg "$sudocmd" | ||
|
||
# select version to install | ||
if [[ -z "${1:-}" ]]; then | ||
require jq | ||
giteaversion=$(curl --connect-timeout 10 -sL https://dl.gitea.io/gitea/version.json | jq -r .latest.version) | ||
else | ||
giteaversion="$1" | ||
fi | ||
|
||
# confirm update | ||
current=$(giteacmd --version | cut --delimiter=' ' --fields=3) | ||
[[ "$current" == "$giteaversion" ]] && echo "$current is already installed, stopping." && exit 1 | ||
echo "Make sure to read the changelog first: https://github.com/go-gitea/gitea/blob/main/CHANGELOG.md" | ||
echo "Are you ready to update Gitea from ${current} to ${giteaversion}? (y/N)" | ||
read -r confirm | ||
[[ "$confirm" == "y" ]] || [[ "$confirm" == "Y" ]] || exit 1 | ||
|
||
pushd "$(pwd)" &>/dev/null | ||
cd "$giteahome" # needed for gitea dump later | ||
|
||
# download new binary | ||
binname="gitea-${giteaversion}-${arch}" | ||
binurl="https://dl.gitea.io/gitea/${giteaversion}/${binname}.xz" | ||
echo "Downloading $binurl..." | ||
curl --connect-timeout 10 --silent --show-error --fail --location -O "$binurl{,.sha256,.asc}" | ||
|
||
# validate checksum & gpg signature (exit script if error) | ||
sha256sum --check "${binname}.xz.sha256" | ||
gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2 | ||
gpg --verify "${binname}.xz.asc" "${binname}.xz" || { echo 'Signature does not match'; exit 1; } | ||
rm "${binname}".xz.{sha256,asc} | ||
|
||
# unpack binary + make executable | ||
xz --decompress "${binname}.xz" | ||
chown "$giteauser" "$binname" | ||
chmod +x "$binname" | ||
|
||
# stop gitea, create backup, replace binary, restart gitea | ||
echo "Stopping gitea at $(date)" | ||
giteacmd manager flush-queues | ||
$sudocmd systemctl stop gitea | ||
echo "Creating backup in $giteahome" | ||
giteacmd dump $backupopts | ||
echo "Updating binary at $giteabin" | ||
mv --force --backup "$binname" "$giteabin" | ||
$sudocmd systemctl start gitea | ||
$sudocmd systemctl status gitea | ||
|
||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.