From 45f9036280c5b02e0f3795239834faeed368dbaf Mon Sep 17 00:00:00 2001
From: Matthew Owens <matthew@owens.tech>
Date: Sat, 5 Sep 2020 14:24:52 +0100
Subject: [PATCH] running correct script, tracking server-side script

---
 dproj          |  2 +-
 new_git_module | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 new_git_module

diff --git a/dproj b/dproj
index f02f034..95fc979 100755
--- a/dproj
+++ b/dproj
@@ -13,7 +13,7 @@ if [ -z $projExists ]; then
 	notify-send 'cecse' "creating $proj module, please wait..."
 	./scripts/new_module $proj
 	notify-send 'cecse' "adding owens.tech remotes..."
-	ssh git@owens.tech "new_module $proj cecse"
+	ssh git@owens.tech "new_git_module $proj cecse"
 	cd $proj
 	git remote set-url --add --push origin git@github.com:cecse/$proj.git
 	git remote set-url --add --push origin git@owens.tech:cecse/$proj.git
diff --git a/new_git_module b/new_git_module
new file mode 100644
index 0000000..4609c51
--- /dev/null
+++ b/new_git_module
@@ -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
-- 
2.20.1