running correct script, tracking server-side script
authorMatthew Owens <matthew@owens.tech>
Sat, 5 Sep 2020 13:24:52 +0000 (14:24 +0100)
committerMatthew Owens <matthew@owens.tech>
Sat, 5 Sep 2020 13:25:16 +0000 (14:25 +0100)
new_git_module [new file with mode: 0644]

diff --git a/new_git_module b/new_git_module
new file mode 100644 (file)
index 0000000..4609c51
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+usage() {
+       echo "$0 <module name> [project name]" 
+}
+
+GIT_HOME="/home/git"
+
+if [[ $# -eq 0 || $# -gt 2 ]]; then
+       usage
+       exit 1
+fi
+
+if [[ "$2" -ne "" ]]; then
+       [[ ! -d "$GIT_HOME/$2" ]] && mkdir -p "$GIT_HOME/$2"
+fi
+
+GIT_HOME="$GIT_HOME/$2"
+
+mkdir "$GIT_HOME/$1.git" "$GIT_HOME/test-$1.git"
+
+cd "$GIT_HOME/$1.git"
+git init --bare
+cat config $GIT_HOME/config > config
+echo "" > description
+
+cd "$GIT_HOME/test-$1.git"
+git init --bare
+cat config $GIT_HOME/config > config
+echo "" > description