-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Add contrib/upgrade.sh
#18286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Add contrib/upgrade.sh
#18286
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1a92ff0
add contrib/upgrade.sh
noerw affb7ff
add script to docs
noerw e515b17
improvements
noerw dc4b496
reword
noerw 45eae89
apply feedback
noerw 715d55f
use slim backup by default
noerw 82e5fbc
use longform command flags
noerw 7079d69
add more logging
noerw 71a1ca9
sane backup defaults
noerw 2a3f62c
add note about gpg key import
noerw ec2f6c3
fix indentation
noerw 775b7db
Update contrib/upgrade.sh
noerw 1b6f8f6
apply shellcheck
noerw a46e122
Merge branch 'main' into contribu-upgrade
noerw dbfcd0f
fix quoting issue
noerw 97b8524
refinements
noerw 7cc90fb
Replace `which` with `command -v`
noerw 17894c5
Merge branch 'main' into contribu-upgrade
zeripath 858a5f9
Update contrib/upgrade.sh
noerw 16e99b1
Update contrib/upgrade.sh
6543 fce8dad
Merge branch 'main' into contribu-upgrade
6543 d81ae00
Merge branch 'main' into contribu-upgrade
6543 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,41 @@ | ||
#!/bin/bash | ||
set -e | ||
noerw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# this is an upgrade script, for gitea deployed on linux as systemd service | ||
# depends on: curl, xz, sha256sum, gpg | ||
# usage: upgrade.sh [version] | ||
|
||
# change the variables below for your local setup | ||
giteaversion=${1:-1.15.10} | ||
noerw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
giteabin=/usr/local/bin/gitea | ||
giteahome=/var/lib/gitea | ||
giteaconf=/etc/gitea/app.ini | ||
giteauser="git" | ||
noerw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
giteacmd="sudo -u $giteauser $giteabin -c $giteaconf -w $giteahome" | ||
noerw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# download new binary | ||
binname=gitea-${giteaversion}-linux-amd64 | ||
binurl="https://dl.gitea.io/gitea/${giteaversion}/${binname}.xz" | ||
echo downloading $binurl | ||
noerw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
cd $giteahome # needed for gitea dump later | ||
noerw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
curl -sSfL "$binurl" > ${binname}.xz | ||
noerw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
curl -sSfL "${binurl}.sha256" > ${binname}.xz.sha256 | ||
curl -sSfL "${binurl}.asc" > ${binname}.xz.asc | ||
|
||
# validate checksum & gpg signature (exit script if error) | ||
sha256sum -c ${binname}.xz.sha256 | ||
gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2 | ||
noerw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
gpg --verify ${binname}.xz.asc ${binname}.xz | ||
rm ${binname}.xz.{sha256,asc} | ||
|
||
# unpack binary + make executable | ||
xz -d ${binname}.xz | ||
chmod +x $binname | ||
noerw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
# stop gitea, create backup, replace binary, restart gitea | ||
$giteacmd manager flush-queues | ||
systemctl stop gitea | ||
noerw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$giteacmd --version | ||
noerw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
$giteacmd dump | ||
noerw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
mv -fb $binname $giteabin | ||
noerw marked this conversation as resolved.
Show resolved
Hide resolved
|
||
systemctl start gitea |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.