f2690b298cef84a054753d5a18d59d22446e19ab
[git-tools-moved-to-github.git] / id-new-project / id-new-project.sh
1 #!/bin/sh
2
3 usage() {
4         echo "Usage:"
5         echo "id-new-project.sh srcdir description {pub/private}"
6         echo "For example:"
7         echo "id-new-project.sh ../myproj \"Which does good things\" private"
8         exit 1
9 }
10
11 SRC=$1
12 DESC=$2
13 TYPE=$3
14
15 if test -z "${TYPE}"; then
16         usage 
17 fi
18
19 if test ! -e post-receive; then
20         echo "file post-receive must be in the current directory"
21         exit 1  
22 fi
23
24 PROJ=`basename $SRC`
25
26 if test -d ${PROJ}.git; then
27         echo "${PROJ}.git already exists"
28         exit 1
29 fi
30
31
32 if git clone --bare $SRC ${PROJ}.git; then
33         cd ${PROJ}.git
34         touch git-daemon-export-ok
35         echo "${DESC}" >description
36         git config core.sharedRepository true
37         git config core.ignorecase true
38         cp ../post-receive hooks/post-receive
39         chmod +x hooks/post-receive
40         git config hooks.mailinglist gitid@indexdata.dk
41         cd ..
42         scp -P 222 -r ${PROJ}.git git.indexdata.com:/home/git/${TYPE}
43         ssh -p 222 git.indexdata.com "cd /home/git/${TYPE}/${PROJ}.git && chmod -R g+w . && chgrp -R git . && find . -type d | xargs chmod g+s"
44 fi
45