From: Matthew Owens Date: Sat, 5 Sep 2020 13:24:52 +0000 (+0100) Subject: running correct script, tracking server-side script X-Git-Url: https://git.owens.tech/dummy.html/dummy.html/git?a=commitdiff_plain;h=45f9036280c5b02e0f3795239834faeed368dbaf;p=scripts.git running correct script, tracking server-side script --- 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 [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