source: lab.git/TipAndDoc/tools/tool/buildtrac.sh @ 625e173

trunk
Last change on this file since 625e173 was dcf4e19, checked in by mitty <mitty@…>, 14 years ago
  • fix typo

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

  • Property mode set to 100755
File size: 1.6 KB
RevLine 
[e135cc7]1#!/bin/sh
2
3set -x
4export LANG=C
5
6PROJECT_NAME="${1:?"usage: $0 <PROJECT_NAME> <SUB_ROOTDIR> <SUBDOMAIN> "}"
7SUB_ROOTDIR="${2:?"usage: $0 <PROJECT_NAME> <SUB_ROOTDIR> <SUBDOMAIN> "}"
8SUBDOMAIN="${3:?"usage: $0 <PROJECT_NAME> <SUB_ROOTDIR> <SUBDOMAIN> "}"
9
10# stop script if "$1" exists
11isexist () {
12    if [ -e "$1" ] ; then
13        echo "$1" already exists
14        exit
15    fi
16}
17
18# set global environments
19NEWTRAC="/var/trac/${SUB_ROOTDIR}/${PROJECT_NAME}"
20TRACBACKUP="/var/backups/trac/${SUB_ROOTDIR}/${PROJECT_NAME}"
21TRACINI="/home/tools/tool/trac.ini.build"
22SVNPATH="/var/svn/${SUB_ROOTDIR}/${PROJECT_NAME}"
23
24# check paths to be created
25isexist ${NEWTRAC}
26isexist ${TRACBACKUP}
27
28# make trac
[dcf4e19]29mkdir -p ${NEWTRAC}
[e135cc7]30trac-admin ${NEWTRAC} initenv ${PROJECT_NAME} sqlite:db/trac.db svn ${SVNPATH}
31trac-admin ${NEWTRAC} permission add mitty TRAC_ADMIN
32chgrp -R www-data ${NEWTRAC}
33chmod -R o-rw ${NEWTRAC}
34chmod -R g-w ${NEWTRAC}
35chmod -R g+w ${NEWTRAC}/attachments
36chmod -R g+w ${NEWTRAC}/db
37chmod -R g+w ${NEWTRAC}/log
38
39# make trac backup
40mkdir -p ${TRACBACKUP}
41chgrp -R www-data ${TRACBACKUP}
42chmod -R g+ws ${TRACBACKUP}
43
44# modify trac.ini
45mv ${NEWTRAC}/conf/trac.ini ${NEWTRAC}/conf/trac.ini.original
46cp ${TRACINI} ${NEWTRAC}/conf/trac.ini
47sed -i s#PROJECT_NAME#${PROJECT_NAME}#g ${NEWTRAC}/conf/trac.ini
48sed -i s#SUBDOMAIN#${SUBDOMAIN}#g ${NEWTRAC}/conf/trac.ini
49sed -i s#SUB_ROOTDIR#${SUB_ROOTDIR}#g ${NEWTRAC}/conf/trac.ini
50sed -i s#SVNPATH#${SVNPATH}#g ${NEWTRAC}/conf/trac.ini
51chgrp -R www-data ${NEWTRAC}/conf/trac.ini
52chmod -R g+w ${NEWTRAC}/conf/trac.ini
53chmod    g+w ${NEWTRAC}/conf
54
55
56echo "done"
57echo "${NEWTRAC} ${TRACBACKUP} are created"
Note: See TracBrowser for help on using the repository browser.