trunk
Rev | Line | |
---|
[e135cc7] | 1 | #!/bin/sh |
---|
| 2 | |
---|
| 3 | set -x |
---|
| 4 | export LANG=C |
---|
| 5 | |
---|
| 6 | PROJECT_NAME="${1:?"usage: $0 <PROJECT_NAME> <SUB_ROOTDIR> [-noinit] "}" |
---|
| 7 | SUB_ROOTDIR="${2:?"usage: $0 <PROJECT_NAME> <SUB_ROOTDIR> [-noinit] "}" |
---|
| 8 | |
---|
| 9 | # stop script if "$1" exists |
---|
| 10 | isexist () { |
---|
| 11 | if [ -e "$1" ] ; then |
---|
| 12 | echo "$1" already exists |
---|
| 13 | exit |
---|
| 14 | fi |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | # set global environments |
---|
| 18 | NEWREPOS="/var/svn/${SUB_ROOTDIR}/${PROJECT_NAME}" |
---|
| 19 | REPOSBACKUP="/var/backups/svn/${SUB_ROOTDIR}/${PROJECT_NAME}" |
---|
| 20 | |
---|
| 21 | HOOKSKEL="/home/tools/svn/hooks" |
---|
| 22 | |
---|
| 23 | # check paths to be created |
---|
| 24 | isexist ${NEWREPOS} |
---|
| 25 | isexist ${REPOSBACKUP} |
---|
| 26 | |
---|
| 27 | # make repos |
---|
| 28 | mkdir -p ${NEWREPOS} |
---|
| 29 | svnadmin create --fs-type fsfs ${NEWREPOS} |
---|
| 30 | for HOOK in `ls ${HOOKSKEL}`; do |
---|
| 31 | ln -s ${HOOKSKEL}/${HOOK} ${NEWREPOS}/hooks |
---|
| 32 | done |
---|
| 33 | mkdir -p ${NEWREPOS}/dav |
---|
| 34 | chgrp -R www-data ${NEWREPOS} |
---|
| 35 | chmod -R o-rw ${NEWREPOS} |
---|
| 36 | chmod -R g+ws ${NEWREPOS}/db |
---|
| 37 | chmod -R g+ws ${NEWREPOS}/dav |
---|
| 38 | |
---|
| 39 | # make repos backup |
---|
| 40 | mkdir -p ${REPOSBACKUP}/incremental |
---|
| 41 | chgrp -R www-data ${REPOSBACKUP} |
---|
| 42 | chmod -R g+ws ${REPOSBACKUP} |
---|
| 43 | |
---|
| 44 | if [ "$3" != "-noinit" ]; then |
---|
| 45 | # initial commit |
---|
| 46 | svn mkdir -m "REPOS init." file://${NEWREPOS}/trunk file://${NEWREPOS}/tags file://${NEWREPOS}/branches file://${NEWREPOS}/vendor |
---|
| 47 | fi |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | echo "done" |
---|
| 51 | echo "${NEWREPOS} ${REPOSBACKUP} are created" |
---|
Note: See
TracBrowser
for help on using the repository browser.