Skip to content

Instantly share code, notes, and snippets.

@raifcoonjah
Created September 14, 2024 19:20
Show Gist options
  • Save raifcoonjah/ef4b879812ddff815603c7cccfa381a0 to your computer and use it in GitHub Desktop.
Save raifcoonjah/ef4b879812ddff815603c7cccfa381a0 to your computer and use it in GitHub Desktop.
A simple script to update forgejo to version specified
#!/bin/bash
set -e
FORGEJO_VERSION="$1"
# Check if the first argument is empty
if [ -z "$1" ]; then
echo "No forgejo version specified, goodbye!"
exit 1
else
echo "Downloading forgejo $1..."
wget https://codeberg.org/forgejo/forgejo/releases/download/v$1/forgejo-$1-linux-amd64 -P /tmp/
echo "Stopping forgejo service..."
systemctl stop forgejo.service
echo "Backuping up app.ini"
cp /etc/forgejo/app.ini /etc/forgejo/app.ini.old
echo "Upgrading forgejo version..."
chmod +x /tmp/forgejo-$1-linux-amd64
cp /tmp/forgejo-$1-linux-amd64 /usr/local/bin/forgejo
echo "Starting forgejo service again..."
systemctl start forgejo.service
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment