summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBiRabittoh <birabittoh@tilde.institute>2023-07-10 11:27:33 +0200
committerBiRabittoh <birabittoh@tilde.institute>2023-07-10 11:27:33 +0200
commit5b8576ad8dcf5275b86369dbcc3b311f479d0ccf (patch)
tree943fccf35cb8819af7b649cf813c7ef42c7d3080
parentd0b48555764c256e84de9024a0d06056d0b27a90 (diff)
downloadmy-docker-compose-5b8576ad8dcf5275b86369dbcc3b311f479d0ccf.tar.gz
add repo creation script
-rwxr-xr-xcgit/add_repo.sh33
1 files changed, 33 insertions, 0 deletions
diff --git a/cgit/add_repo.sh b/cgit/add_repo.sh
new file mode 100755
index 0000000..53c083f
--- /dev/null
+++ b/cgit/add_repo.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+BASE_REPO_DIR="/etc/config/cgit"
+GIT_USER="BiRabittoh"
+GIT_EMAIL="birabittoh@duck.com"
+
+# Ask the user for repo details
+read -p 'Nome repo: ' repo_name
+read -p 'Descrizione: ' repo_desc
+
+# TODO: check input
+if [ -z "$repo_name" ]; then
+      exit 1
+fi
+if [ -z "$repo_desc" ]; then
+      exit 1
+fi
+
+repo_path="$BASE_REPO_DIR/$repo_name"
+
+if [ -d "$repo_path" ]; then
+    echo "$repo_name already exists."
+    exit 1
+fi
+
+echo "Looks good: $repo_path"
+# Actually create repo
+mkdir $repo_path
+git init --bare $repo_path
+git -C $repo_path config --local gitweb.owner "$GIT_USER <$GIT_EMAIL>"
+echo "$repo_desc" > $repo_path/description
+
+echo "Done."