source: lab.git/TipAndDoc/tools/tool/buildrepos.sh @ 486340b

trunk
Last change on this file since 486340b was e054fd4, checked in by mitty <mitty@…>, 13 years ago
  • FIX: initial commit and then chmod repository files
  • FIX: ${NEWREPOS}/db: +ws -> +wX

git-svn-id: https://lab.mitty.jp/svn/lab/trunk@128 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

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