From dd55f98281c1c0c28a5f8df3c87031bc84dd450d Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Thu, 26 Jun 2025 00:23:53 +0000 Subject: custom scripts used to manage the public access system --- bin/sync-cgit-repos.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 bin/sync-cgit-repos.sh (limited to 'bin/sync-cgit-repos.sh') diff --git a/bin/sync-cgit-repos.sh b/bin/sync-cgit-repos.sh new file mode 100755 index 0000000..007d2c7 --- /dev/null +++ b/bin/sync-cgit-repos.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +BASE_HOME="/home/publicaccess/home" +CGIT_DIR="/srv/git/listed" + +mkdir -p "$CGIT_DIR" + +for user_dir in "$BASE_HOME"/*; do + [ -d "$user_dir/git/listed" ] || continue + username=$(basename "$user_dir") + + for repo in "$user_dir/git/listed/"*.git; do + [ -d "$repo" ] || continue + reponame=$(basename "$repo") + mount_point="${CGIT_DIR}/${username}-${reponame}" + + # Create the mount point directory if it doesn't exist + mkdir -p "$mount_point" + + # Bind mount the repo to the cgit directory + mountpoint -q "$mount_point" || mount --bind "$repo" "$mount_point" + done +done -- cgit v1.2.3