diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2010-05-21 12:47:02 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2010-05-21 12:47:02 +0200 |
commit | 6f71dffa1b1002cec4975bac08b8a0b62a01cc80 (patch) | |
tree | 24306db89ccde87395ab9bb1ce460ae46bc58fbc | |
parent | Cleanup new project script -- use control master signaling to exit, better output. (diff) | |
download | GitTools-6f71dffa1b1002cec4975bac08b8a0b62a01cc80.tar.xz GitTools-6f71dffa1b1002cec4975bac08b8a0b62a01cc80.zip |
Do not assume repo path nor post command.
-rwxr-xr-x | NewProject.sh | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/NewProject.sh b/NewProject.sh index 9a09158..191face 100755 --- a/NewProject.sh +++ b/NewProject.sh @@ -4,6 +4,8 @@ USER="git" HOST="labs.anyclip.com" +REPOS="/home/git" +POSTCMD="$REPOS/updatewebinterface.sh" ################################# @@ -21,7 +23,7 @@ fi # Initialize constants repository="`pwd | xargs -0 basename | tr -d ' '`" connection="$USER@$HOST" -hash="`echo $repository $connection $(date +%s%N) | md5sum | cut -d ' ' -f 1`" +hash="`echo $REPOS $repository $connection $(date +%s%N) | md5sum | cut -d ' ' -f 1`" options="-o ControlMaster=auto -o ControlPath=./.sshcontrolmaster-$hash" gitsshpath="./.gitssh-$hash" @@ -43,18 +45,19 @@ echo "success." # Create bare repo on server echo -n "[*] Creating bare remote repository..." ssh $options $connection "\ - mkdir \"$repository\";\ - cd \"$repository\"; - git init --bare;\ - echo \"$1\" > description;\ - mv hooks/post-update.sample hooks/post-update;\ + cd \"$REPOS\" && \ + mkdir \"$repository\" &&\ + cd \"$repository\" &&\ + git init --bare &&\ + echo \"$1\" > description &&\ + mv hooks/post-update.sample hooks/post-update &&\ chmod +x hooks/post-update;" > /dev/null 2>&1 || (echo "failure!"; exit 1) echo "success." # Add configuration for remote repo to local repo echo -n "[*] Setting up local configuration..." echo "[remote \"origin\"] - url = $connection:$repository + url = $connection:$REPOS/$repository fetch = +refs/heads/*:refs/remotes/origin/* [branch \"master\"] remote = origin @@ -68,7 +71,7 @@ echo "success." # Update cgit by calling script echo -n "[*] Updating cgit web interface..." -ssh $options $connection "~/updatewebinterface.sh" || (echo "failure!"; exit 1) +ssh $options $connection "$POSTCMD" || (echo "failure!"; exit 1) echo "success." # Kill the ssh control master, delete gitssh wrapper |