8 Commits

Author SHA1 Message Date
Xijiang Yu
068d7a513a fix(upgrade.sh): use HTTPS for GPG key import and restore SELinux context after upgrade (#36930)
## Summary

Two bug fixes for `contrib/upgrade.sh` found during a real-world upgrade
from 1.24.3 to 1.25.5 on Fedora.

---

### Fix 1: GPG key import fails when HKP port 11371 is blocked (closes
#36928)

**Before:**
```bash
gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
```
This uses HKP port **11371**, which is blocked by many firewalls. The
upgrade aborts with:
```
gpg: keyserver receive failed: Connection timed out
```

**After:**
```bash
curl -fsSL --connect-timeout 10 \
  "https://keys.openpgp.org/vks/v1/by-fingerprint/7C9E68152594688862D62AF62D9AE806EC1592E2" \
  | gpg --import \
  || gpg --keyserver keyserver.ubuntu.com --recv 7C9E68152594688862D62AF62D9AE806EC1592E2 \
  || gpg --keyserver keys.openpgp.org --recv 7C9E68152594688862D62AF62D9AE806EC1592E2
```
Same `keys.openpgp.org` server, same key — but fetched over **HTTPS port
443** which is universally accessible. Keyservers remain as fallbacks.

---

### Fix 2: Gitea fails to start after upgrade on SELinux systems (closes
#36929)

**Problem:** After `mv`-ing the binary from `$giteahome` to
`/usr/local/bin/gitea`, the file retains the SELinux context of the
source directory. Systemd refuses to execute it, exiting with
`status=203/EXEC`.

**Fix:** Add a `restorecon` call guarded by `command -v` so it is a
no-op on non-SELinux systems:
```bash
command -v restorecon &>/dev/null && restorecon -v "$giteabin" || true
```
Verified: `restorecon -v /usr/local/bin/gitea` immediately restored
service on the affected machine.

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-03-19 11:12:53 -07:00
eric-j-ason
c4b70c57bc exit with success when already up to date (#35312)
Exit `upgrade.sh` with status 0 (instead of status 1) when the installed
Gitea is already on the latest version and nothing needs to be done.

Fixes #35309
2025-08-19 11:49:01 -07:00
TATHAGATA ROY
d5e93413bc Updated upgrade script that is informing user that Gitea service has to be running in order to upgrade it (#24260)
Hello sir,
This pull request solves issue #23949
I have updated the upgrade script such that it will check if the Gitea
service is running, if it's not running then it will exit the process
and if it's running then the process will move further ahead.
Thank You.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: silverwind <me@silverwind.io>
2023-04-25 13:19:58 -04:00
techknowlogick
5e389228f6 update upgrade script to use new CDN (#24280)
The upgrade script has to deal with redirects due to pointing to former
CDN, this reduces HTTP calls by 2

setting as skip-changelog, due to it being a contrib script
2023-04-23 14:29:03 +08:00
YISH
af09136b95 Fix upgrade.sh script error with su -c (#19483)
* Fix scirpt err with `su -c`, add env auto loading.

* Update upgrade.sh

* Update upgrade.sh

* Update contrib/upgrade.sh

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2022-04-26 23:30:29 -04:00
Norwin
42fe076084 Fix contrib/upgrade.sh (#19222)
* fix idempotency of script (eg when aborting the downloads)
* improve readability (user facing variables first, definitions next, statements last)
* improve dependency checks
* fix ignored $giteaversion variable
* more logging
* print usage string on incorrect usage
2022-03-27 18:48:08 +01:00
YISH
ddf7f1319f Fix script compatiable with OpenWrt (#19000)
* Fix compatibility of upgrade.sh in openwrt and add service init script for openwrt.

* Apply suggestions from code review

Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: zeripath <art27@cantab.net>

* Update contrib/upgrade.sh

Co-authored-by: Norwin <noerw@users.noreply.github.com>

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Norwin <noerw@users.noreply.github.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2022-03-08 17:58:14 -05:00
Norwin
6ada05940e Add contrib/upgrade.sh (#18286)
Adds an upgrade script that automates upgrading installations on Linux from binary releases, so people don't need to reinvent the wheel. Hopefully this leads to less questions about how to upgrade, and consequently less Gitea instances running unmaintained versions in the wild.

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
2022-02-06 21:07:52 +01:00