From 2cd9a4039c0c5f524df0a33605c9baef1f57917e Mon Sep 17 00:00:00 2001 From: Akshay Nair Date: Sat, 4 Jul 2026 18:12:10 +0530 Subject: Add git shell commands --- setup.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'setup.sh') diff --git a/setup.sh b/setup.sh index 3f05f3b..efd3346 100755 --- a/setup.sh +++ b/setup.sh @@ -5,7 +5,7 @@ set -eu ROOT_DIR=${ROOT_DIR:-"/opt/project"} configure() { - configure_user && configure_fs && configure_packages && configure_firewall + configure_user && configure_fs && configure_packages && configure_git && configure_firewall } services() { cd "$ROOT_DIR"; docker compose --profile services "$@"; } @@ -22,7 +22,14 @@ stop() { services down; } configure_packages() { apt install \ docker.io docker-buildx docker-compose-v2 \ - ufw + git ufw +} + +configure_git() { + sudo -u git git config --global init.defaultBranch main + # kept explicit shell setup + chsh -s "$(which git-shell)" git + cp -rf "$ROOT_DIR/cgit/ssh/git-shell-commands" /home/git/ } configure_firewall() { @@ -34,7 +41,7 @@ configure_firewall() { configure_user() { groupadd -f -g 1001 git - useradd --shell /usr/sbin/nologin --no-create-home git --uid 1001 --gid 1001 || true + useradd --shell /usr/sbin/nologin git --uid 1001 --gid 1001 || true groupadd -f -g 1002 send useradd --shell /usr/sbin/nologin --no-create-home send --uid 1002 --gid 1002 || true } @@ -54,6 +61,6 @@ update() { cmd="$1"; shift; case "$cmd" in update|start|startfg|stop|services|core) "$cmd" "$@" ;; - configure|configure_firewall|configure_user|configure_fs|configure_packages) "$cmd" "$@" ;; + configure|configure_firewall|configure_user|configure_fs|configure_packages|configure_git) "$cmd" "$@" ;; *) echo "Invalid command: $cmd"; exit 1 ;; esac -- cgit v1.3.1