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:24:52 +0000 (14:24 +0100)
dproj
new_git_module [new file with mode: 0644]

diff --git a/dproj b/dproj
index f02f034..95fc979 100755 (executable)
--- 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 (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