2024-05-30 11:59:27 +02:00
|
|
|
# Get latest forgejo tag
|
2024-05-30 13:16:26 +02:00
|
|
|
LATEST=$(curl -fsS https://codeberg.org/forgejo/forgejo/releases/latest | grep -o "[0-9].[0-9].[0-9]" | head -1)
|
2024-05-30 13:10:20 +02:00
|
|
|
|
|
|
|
# Check if already installed
|
|
|
|
if [[ $(forgejo -v 2> /dev/null | grep -o "[0-9].[0-9].[0-9]" | head -1) != $LATEST ]]; then
|
|
|
|
# Download forgejo
|
2024-05-30 13:22:15 +02:00
|
|
|
wget "https://codeberg.org/forgejo/forgejo/releases/download/v$LATEST/forgejo-$LATEST-linux-amd64"
|
2024-05-30 13:10:20 +02:00
|
|
|
chmod +x "forgejo-$LATEST-linux-amd64"
|
|
|
|
|
|
|
|
# Check GPG Keys
|
|
|
|
gpg --keyserver keys.openpgp.org --recv EB114F5E6C0DC2BCDD183550A4B61A2DC5923710
|
|
|
|
wget "https://codeberg.org/forgejo/forgejo/releases/download/v$LATEST/forgejo-$LATEST-linux-amd64.asc"
|
|
|
|
gpg --verify "forgejo-$LATEST-linux-amd64.asc" "forgejo-$LATEST-linux-amd64"
|
|
|
|
|
|
|
|
# Create group and user
|
|
|
|
groupadd --system forgejo
|
|
|
|
|
|
|
|
useradd --system \
|
2024-05-30 13:28:34 +02:00
|
|
|
--gid forgejo \
|
2024-05-30 13:10:20 +02:00
|
|
|
--create-home \
|
|
|
|
--home-dir /var/lib/forgejo \
|
|
|
|
--shell /usr/sbin/nologin \
|
|
|
|
--comment "Forgejo Git forge" \
|
|
|
|
forgejo
|
|
|
|
|
|
|
|
# Setup forgejo directories
|
|
|
|
mv "forgejo-$LATEST-linux-amd64" /usr/local/bin/forgejo
|
|
|
|
fi
|
2024-05-30 11:59:27 +02:00
|
|
|
|
|
|
|
## Working directory
|
2024-05-30 13:12:07 +02:00
|
|
|
mkdir -p /var/lib/forgejo
|
2024-05-30 11:59:27 +02:00
|
|
|
chown forgejo:forgejo /var/lib/forgejo && chmod 750 /var/lib/forgejo
|
|
|
|
|
|
|
|
## Config directory
|
2024-05-30 13:12:07 +02:00
|
|
|
mkdir -p /etc/forgejo
|
2024-05-30 11:59:27 +02:00
|
|
|
chown root:forgejo /etc/forgejo && chmod 540 /etc/forgejo
|
|
|
|
|
|
|
|
# Check requirements
|
|
|
|
nala install -y git git-lfs
|
|
|
|
|
|
|
|
# Install database
|
|
|
|
# ??? source or inline config, make table ... ?
|
|
|
|
# source ../postgresql/_install.sh
|
|
|
|
|
|
|
|
# Install runner
|
|
|
|
# ???
|