From ce70e66c70c03439ed8f905b6412fcf1a70be0f3 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Wed, 11 Dec 2024 03:30:36 +0100 Subject: [PATCH] Make `forgejo` work under Arch Linux --- .../Software/docker/services/forgejo/docker-compose.base.yml | 2 +- scripts/Common/Software/docker/services/forgejo/main.fish | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/Common/Software/docker/services/forgejo/docker-compose.base.yml b/scripts/Common/Software/docker/services/forgejo/docker-compose.base.yml index a27e4d41..5b6122dd 100644 --- a/scripts/Common/Software/docker/services/forgejo/docker-compose.base.yml +++ b/scripts/Common/Software/docker/services/forgejo/docker-compose.base.yml @@ -24,7 +24,7 @@ services: - ./data/forgejo:/data - config:/data/gitea/conf - /etc/timezone:/etc/timezone:ro - - /home/forgejo/.ssh:/data/git/.ssh + - /srv/git/.ssh:/data/git/.ssh db: image: mariadb restart: unless-stopped diff --git a/scripts/Common/Software/docker/services/forgejo/main.fish b/scripts/Common/Software/docker/services/forgejo/main.fish index 218dda24..6d3f3d36 100755 --- a/scripts/Common/Software/docker/services/forgejo/main.fish +++ b/scripts/Common/Software/docker/services/forgejo/main.fish @@ -48,6 +48,7 @@ begin set -l port set -l file (mktemp) set -l root (getServiceRoot $argv) + set -l home /srv/git set -l dir "$root/data" set -l bin /usr/local/bin/forgejo set -l config "$root/docker-compose.base.yml" @@ -60,18 +61,20 @@ begin --system \ --shell /bin/bash \ --comment 'Git Version Control' \ - --create-home \ $user set uid (id -u $user) set gid (id -g $user) + and sudo usermod -d "$home" "$user" and yq "$envKey.USER_UID = $uid" "$file" | yq "$envKey.USER_GID = $gid" | sudo tee "$config" >/dev/null and sudo mkdir -p "$dir" + and sudo mkdir -p "$home" and sudo chown -R $uid:$gid "$dir" + and sudo chown -R $uid:$gid "$home" and sudo -u "#$uid" mkdir -p ~"$user"/.ssh rm "$file"