loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

[BRANDING] adapt forgejo/contrib/upgrade.sh

Reviewed at: https://codeberg.org/forgejo/forgejo/pulls/605

(cherry picked from commit ab986185d08a30e0172c4fcd7870803c31f843bd)
(cherry picked from commit 6068aed2a7f413e3196dd4cf704bc2cf63b36329)
(cherry picked from commit 0cbd599c0c418f9a53a039fd06d9861ac58dcc68)
(cherry picked from commit c3ef13588230e8eba9c42ddfddf966a20ab3f745)
(cherry picked from commit 0ba7194fa1cb709b40a6699a8bda29292999277b)
(cherry picked from commit 572a2a51252075c5e0e64b91c5a09c5b34353f71)
(cherry picked from commit dd0a7265e12abec694828381aaa4e1f1c4c634e7)
(cherry picked from commit 06bd195f4e9a963fead7295d9ca76ed185176675)
(cherry picked from commit 7f6100ab6ba2e0671cc2450f65d7b0933afec936)
(cherry picked from commit 58af04560a00b0f09ee8ba6ef3aa75cdf577edc2)
(cherry picked from commit 67a951f726dee99d7c035bf781c9c7253eba228f)
(cherry picked from commit 46e68309adf44ef2c6795d9de673a9327803cf7e)
(cherry picked from commit 9002654915ec16f1962f8408c39d5360dfd7dad5)
(cherry picked from commit 3f1a3a13113f186993856c77e784abb9f5917c7c)
(cherry picked from commit df1716deb446bd021c7ee4bd610fb0f06706613a)
(cherry picked from commit 8ace62b4135a944921d3ba1465bf89cb702b74b9)
(cherry picked from commit 30ab21f2642e29833eba9fbe75f9e7bd8b6ec3da)
(cherry picked from commit 7ec99bfc0da0b3c70c8ff9e5bc770c3e8a4dd495)
(cherry picked from commit 47a554c9b41db0bfe4e612838a5e30e234d067cd)
(cherry picked from commit c5aaf49d88c14f11b733ec6fb23f85f633a48196)
(cherry picked from commit 7fb42a78a41f1d3522a50d8193cb61e4df282acd)
(cherry picked from commit 336fd64a1f1fc70a9ebe3f238c591128abbfbb16)
(cherry picked from commit a7d590f7d71c2cdb37088f6f84ca3e493189583a)
(cherry picked from commit b6aa4a40e4eb4de1615c13a1aa5a511d668be967)
(cherry picked from commit fc195b0349d8c23d00ec070f6ca0448a4ae36903)
(cherry picked from commit 3c6799ad041ee5b749099b0852a1fa3f92847c40)
(cherry picked from commit 86830ae32be2fd31ac1287552d00cba0d11155b0)
(cherry picked from commit e70eb6a27781045d16c86920501658894cf3ae29)
(cherry picked from commit b18596eb91fdd2a3bce57b1031e70359ed3fe815)
(cherry picked from commit 4a54f7f8601754c583a3810c597529a46344ffa6)
(cherry picked from commit a3a98852499e97915103876eac3566c704acff46)
(cherry picked from commit ec8bbabf34a3d1a65b63e11234e7c62e4b3c23e5)
(cherry picked from commit 5b239033b613515e0495e1a2ed1c309cb638561e)
(cherry picked from commit b1fa48e260873a3bf80d54c836c49d3aa384a74c)
(cherry picked from commit 148f366431e79eea9aa99f61c8f1dbe895515f77)
(cherry picked from commit 79e10923c1fe42ac95e71e07764592c533be5b01)
(cherry picked from commit 7aa72a9b4f646a59e4940153109968ee1ee10734)
(cherry picked from commit 5be4a1da1b328a7af90e8cecaa622a1e3bb41048)
(cherry picked from commit 2297cfcca9be37977b9adca317d1066c75c68f83)
(cherry picked from commit 111f5c104403cecb591aecc1acd984709793e67f)
(cherry picked from commit baa9877bfe43f59ff7d7e063ae91f91102d3b287)
(cherry picked from commit 085050da1fc525add9f03942141df30e9165de0e)

authored by

lauralani and committed by
Earl Warren
cc88c106 8ca21041

+47 -47
+47 -47
contrib/upgrade.sh
··· 1 1 #!/usr/bin/env bash 2 - # This is an update script for gitea installed via the binary distribution 3 - # from dl.gitea.com on linux as systemd service. It performs a backup and updates 4 - # Gitea in place. 5 - # NOTE: This adds the GPG Signing Key of the Gitea maintainers to the keyring. 2 + # This is an update script for forgejo installed via the binary distribution 3 + # from codeberg.org/forgejo/forgejo on linux as systemd service. It 4 + # performs a backup and updates Forgejo in place. 5 + # NOTE: This adds the GPG Signing Key of the Forgejo maintainers to the keyring. 6 6 # Depends on: bash, curl, xz, sha256sum. optionally jq, gpg 7 7 # See section below for available environment vars. 8 8 # When no version is specified, updates to the latest release. 9 9 # Examples: 10 10 # upgrade.sh 1.15.10 11 - # giteahome=/opt/gitea giteaconf=$giteahome/app.ini upgrade.sh 11 + # forgejohome=/opt/forgejo forgejoconf=$forgejohome/app.ini upgrade.sh 12 12 13 - # Check if gitea service is running 14 - if ! pidof gitea &> /dev/null; then 15 - echo "Error: gitea is not running." 13 + # Check if forgejo service is running 14 + if ! pidof forgejo &> /dev/null; then 15 + echo "Error: forgejo is not running." 16 16 exit 1 17 17 fi 18 18 19 - # Continue with rest of the script if gitea is running 20 - echo "Gitea is running. Continuing with rest of script..." 19 + # Continue with rest of the script if forgejo is running 20 + echo "Forgejo is running. Continuing with rest of script..." 21 21 22 22 # apply variables from environment 23 - : "${giteabin:="/usr/local/bin/gitea"}" 24 - : "${giteahome:="/var/lib/gitea"}" 25 - : "${giteaconf:="/etc/gitea/app.ini"}" 26 - : "${giteauser:="git"}" 23 + : "${forgejobin:="/usr/local/bin/forgejo"}" 24 + : "${forgejohome:="/var/lib/forgejo"}" 25 + : "${forgejoconf:="/etc/forgejo/app.ini"}" 26 + : "${forgejouser:="git"}" 27 27 : "${sudocmd:="sudo"}" 28 28 : "${arch:="linux-amd64"}" 29 - : "${service_start:="$sudocmd systemctl start gitea"}" 30 - : "${service_stop:="$sudocmd systemctl stop gitea"}" 31 - : "${service_status:="$sudocmd systemctl status gitea"}" 32 - : "${backupopts:=""}" # see `gitea dump --help` for available options 29 + : "${service_start:="$sudocmd systemctl start forgejo"}" 30 + : "${service_stop:="$sudocmd systemctl stop forgejo"}" 31 + : "${service_status:="$sudocmd systemctl status forgejo"}" 32 + : "${backupopts:=""}" # see `forgejo dump --help` for available options 33 33 34 - function giteacmd { 34 + function forgejocmd { 35 35 if [[ $sudocmd = "su" ]]; then 36 36 # `-c` only accept one string as argument. 37 - "$sudocmd" - "$giteauser" -c "$(printf "%q " "$giteabin" "--config" "$giteaconf" "--work-path" "$giteahome" "$@")" 37 + "$sudocmd" - "$forgejouser" -c "$(printf "%q " "$forgejobin" "--config" "$forgejoconf" "--work-path" "$forgejohome" "$@")" 38 38 else 39 - "$sudocmd" --user "$giteauser" "$giteabin" --config "$giteaconf" --work-path "$giteahome" "$@" 39 + "$sudocmd" --user "$forgejouser" "$forgejobin" --config "$forgejoconf" --work-path "$forgejohome" "$@" 40 40 fi 41 41 } 42 42 ··· 49 49 # parse command line arguments 50 50 while true; do 51 51 case "$1" in 52 - -v | --version ) giteaversion="$2"; shift 2 ;; 52 + -v | --version ) forgejoversion="$2"; shift 2 ;; 53 53 -y | --yes ) no_confirm="yes"; shift ;; 54 54 --ignore-gpg) ignore_gpg="yes"; shift ;; 55 55 "" | -- ) shift; break ;; ··· 65 65 66 66 if [[ "$os_release" =~ "OpenWrt" ]]; then 67 67 sudocmd="su" 68 - service_start="/etc/init.d/gitea start" 69 - service_stop="/etc/init.d/gitea stop" 70 - service_status="/etc/init.d/gitea status" 68 + service_start="/etc/init.d/forgejo start" 69 + service_stop="/etc/init.d/forgejo stop" 70 + service_status="/etc/init.d/forgejo status" 71 71 else 72 72 require systemctl 73 73 fi ··· 76 76 require curl xz sha256sum "$sudocmd" 77 77 78 78 # select version to install 79 - if [[ -z "${giteaversion:-}" ]]; then 79 + if [[ -z "${forgejoversion:-}" ]]; then 80 80 require jq 81 - giteaversion=$(curl --connect-timeout 10 -sL https://dl.gitea.com/gitea/version.json | jq -r .latest.version) 82 - echo "Latest available version is $giteaversion" 81 + forgejoversion=$(curl --connect-timeout 10 -sL 'https://codeberg.org/api/v1/repos/forgejo/forgejo/releases?draft=false&pre-release=false&limit=1' -H 'accept: application/json' | jq -r '.[0].tag_name | sub("v"; "")') 82 + echo "Latest available version is $forgejoversion" 83 83 fi 84 84 85 85 # confirm update 86 86 echo "Checking currently installed version..." 87 - current=$(giteacmd --version | cut -d ' ' -f 3) 88 - [[ "$current" == "$giteaversion" ]] && echo "$current is already installed, stopping." && exit 1 87 + current=$(forgejocmd --version | cut -d ' ' -f 3) 88 + [[ "$current" == "$forgejoversion" ]] && echo "$current is already installed, stopping." && exit 1 89 89 if [[ -z "${no_confirm:-}" ]]; then 90 - echo "Make sure to read the changelog first: https://github.com/go-gitea/gitea/blob/main/CHANGELOG.md" 91 - echo "Are you ready to update Gitea from ${current} to ${giteaversion}? (y/N)" 90 + echo "Make sure to read the changelog first: https://codeberg.org/forgejo/forgejo/src/branch/forgejo/CHANGELOG.md" 91 + echo "Are you ready to update forgejo from ${current} to ${forgejoversion}? (y/N)" 92 92 read -r confirm 93 93 [[ "$confirm" == "y" ]] || [[ "$confirm" == "Y" ]] || exit 1 94 94 fi 95 95 96 - echo "Upgrading gitea from $current to $giteaversion ..." 96 + echo "Upgrading forgejo from $current to $forgejoversion ..." 97 97 98 98 pushd "$(pwd)" &>/dev/null 99 - cd "$giteahome" # needed for gitea dump later 99 + cd "$forgejohome" # needed for forgejo dump later 100 100 101 101 # download new binary 102 - binname="gitea-${giteaversion}-${arch}" 103 - binurl="https://dl.gitea.com/gitea/${giteaversion}/${binname}.xz" 102 + binname="forgejo-${forgejoversion}-${arch}" 103 + binurl="https://codeberg.org/forgejo/forgejo/releases/download/v${forgejoversion}/${binname}.xz" 104 104 echo "Downloading $binurl..." 105 105 curl --connect-timeout 10 --silent --show-error --fail --location -O "$binurl{,.sha256,.asc}" 106 106 ··· 108 108 sha256sum -c "${binname}.xz.sha256" 109 109 if [[ -z "${ignore_gpg:-}" ]]; then 110 110 require gpg 111 - gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2 111 + gpg --keyserver keys.openpgp.org --recv EB114F5E6C0DC2BCDD183550A4B61A2DC5923710 112 112 gpg --verify "${binname}.xz.asc" "${binname}.xz" || { echo 'Signature does not match'; exit 1; } 113 113 fi 114 114 rm "${binname}".xz.{sha256,asc} 115 115 116 116 # unpack binary + make executable 117 117 xz --decompress --force "${binname}.xz" 118 - chown "$giteauser" "$binname" 118 + chown "$forgejouser" "$binname" 119 119 chmod +x "$binname" 120 120 121 - # stop gitea, create backup, replace binary, restart gitea 122 - echo "Flushing gitea queues at $(date)" 123 - giteacmd manager flush-queues 124 - echo "Stopping gitea at $(date)" 121 + # stop forgejo, create backup, replace binary, restart forgejo 122 + echo "Flushing forgejo queues at $(date)" 123 + forgejocmd manager flush-queues 124 + echo "Stopping forgejo at $(date)" 125 125 $service_stop 126 - echo "Creating backup in $giteahome" 127 - giteacmd dump $backupopts 128 - echo "Updating binary at $giteabin" 129 - cp -f "$giteabin" "$giteabin.bak" && mv -f "$binname" "$giteabin" 126 + echo "Creating backup in $forgejohome" 127 + forgejocmd dump $backupopts 128 + echo "Updating binary at $forgejobin" 129 + cp -f "$forgejobin" "$forgejobin.bak" && mv -f "$binname" "$forgejobin" 130 130 $service_start 131 131 $service_status 132 132 133 - echo "Upgrade to $giteaversion successful!" 133 + echo "Upgrade to $forgejoversion successful!" 134 134 135 135 popd