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

trunk
Last change on this file since e135cc7 was e135cc7, checked in by mitty <mitty@…>, 14 years ago
  • publish internal tools for svn/trac

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

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