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 |
---|
[e054fd4] | 33 | |
---|
| 34 | if [ "$3" != "-noinit" ]; then |
---|
| 35 | # initial commit |
---|
| 36 | svn mkdir -m "REPOS init." file://${NEWREPOS}/trunk file://${NEWREPOS}/tags file://${NEWREPOS}/branches file://${NEWREPOS}/vendor |
---|
| 37 | fi |
---|
| 38 | |
---|
| 39 | # set permission |
---|
[e135cc7] | 40 | mkdir -p ${NEWREPOS}/dav |
---|
| 41 | chgrp -R www-data ${NEWREPOS} |
---|
[e054fd4] | 42 | chmod -R o-rwx ${NEWREPOS} |
---|
| 43 | chmod -R g+wX ${NEWREPOS}/db |
---|
| 44 | chmod g+ws ${NEWREPOS}/dav |
---|
[e135cc7] | 45 | |
---|
| 46 | # make repos backup |
---|
| 47 | mkdir -p ${REPOSBACKUP}/incremental |
---|
| 48 | chgrp -R www-data ${REPOSBACKUP} |
---|
| 49 | chmod -R g+ws ${REPOSBACKUP} |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | echo "done" |
---|
| 53 | echo "${NEWREPOS} ${REPOSBACKUP} are created" |
---|
Note: See
TracBrowser
for help on using the repository browser.