Added script to create new Git projects.
authorAdam Dickmeiss <adam@indexdata.dk>
Wed, 30 Apr 2008 09:01:51 +0000 (11:01 +0200)
committerAdam Dickmeiss <adam@indexdata.dk>
Wed, 30 Apr 2008 09:01:51 +0000 (11:01 +0200)
id-new-project.sh [new file with mode: 0755]

diff --git a/id-new-project.sh b/id-new-project.sh
new file mode 100755 (executable)
index 0000000..42d9410
--- /dev/null
@@ -0,0 +1,44 @@
+#!/bin/sh
+
+usage() {
+       echo "Usage:"
+       echo "id-new-git.sh srcdir description {pub/private}"
+       echo "For example:"
+       echo "id-new-git.sh ../myproj \"Which does good things\" private"
+       exit 1
+}
+
+SRC=$1
+DESC=$2
+TYPE=$3
+
+if test -z "${TYPE}"; then
+       usage 
+fi
+
+if test ! -e post-receive-email-id; then
+       echo "file post-receive-email-id must be in current directory"
+       exit 1  
+fi
+
+PROJ=`basename $SRC`
+
+if test -d ${PROJ}.git; then
+       echo "${PROJ}.git already exists"
+       exit 1
+fi
+
+
+if git clone --bare $SRC ${PROJ}.git; then
+       cd ${PROJ}.git
+       touch git-daemon-export-ok
+       echo "${DESC}" >description
+       git config core.sharedRepository true
+       cp ../post-receive-email-id hooks/post-receive
+       chmod +x hooks/post-receive
+       git config hooks.mailinglist gitid@indexdata.dk
+       cd ..
+       scp -r ${PROJ}.git git.indexdata.com:/home/git/${TYPE}
+       ssh git.indexdata.com "cd /home/git/${TYPE}/${PROJ}.git && chmod -R g+w . && chgrp -R git . && find . -type d | xargs chmod g+s"
+fi
+