forked from cohabit/server_config
47 lines
1.4 KiB
Bash
47 lines
1.4 KiB
Bash
# Get latest forgejo tag
|
|
LATEST=$(curl -fsS https://codeberg.org/forgejo/forgejo/releases/latest | grep -o "[0-9].[0-9].[0-9]" | head -1)
|
|
|
|
# Check if already installed
|
|
if [[ $(forgejo -v 2> /dev/null | grep -o "[0-9].[0-9].[0-9]" | head -1) != $LATEST ]]; then
|
|
# Download forgejo
|
|
wget "https://codeberg.org/forgejo/forgejo/releases/download/v$LATEST/forgejo-$LATEST-linux-amd64"
|
|
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 \
|
|
--gid forgejo \
|
|
--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
|
|
|
|
## Working directory
|
|
mkdir -p /var/lib/forgejo
|
|
chown forgejo:forgejo /var/lib/forgejo && chmod 750 /var/lib/forgejo
|
|
|
|
## Config directory
|
|
mkdir -p /etc/forgejo
|
|
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
|
|
# ???
|