217 lines
4.7 KiB
Bash
Executable File
217 lines
4.7 KiB
Bash
Executable File
#!/bin/sh
|
|
# ViewVC installation script for CustIS
|
|
|
|
if [ -f custis-install-config ]; then
|
|
. custis-install-config
|
|
else
|
|
cat >custis-install-config <<EOF
|
|
CVS_ASYNC=
|
|
SVN_ASYNC=
|
|
CVS_USER=www-data
|
|
CVS_GROUP=cvs.users
|
|
CVSROOTS=
|
|
SVNROOT=
|
|
SVN_FORBIDDENRE=
|
|
|
|
DB_HOST=
|
|
DB_PORT=
|
|
DB_SOCKET=/var/run/mysqld/mysqld.sock
|
|
DB=
|
|
DB_USER=
|
|
DB_PASSWD=
|
|
|
|
VIEWVC_DIR=
|
|
VIEWVC_URI=/
|
|
VIEWVC_URI_SLASH=/
|
|
VIEWVC_STATIC_URI=/static
|
|
http_proxy=
|
|
no_proxy=
|
|
EOF
|
|
echo Empty 'custis-install-config' initialized, please edit it before installation.
|
|
exit
|
|
fi
|
|
|
|
if [ ! "$DB" -o ! "$VIEWVC_DIR" ]; then
|
|
echo Please set up 'custis-install-config' before installation.
|
|
exit
|
|
fi
|
|
|
|
################################################################################
|
|
|
|
export http_proxy
|
|
export no_proxy
|
|
|
|
DEPS="python libapache2-mod-python rcs diff cvsnt subversion subversion-tools python-setuptools python-subversion python-mysqldb cvsgraph"
|
|
|
|
echo "*** Installing dependency packages: $DEPS"
|
|
apt-get install $DEPS
|
|
|
|
echo "*** Installing Pygments for Python"
|
|
wget http://pypi.python.org/packages/source/P/Pygments/Pygments-0.11.1.tar.gz
|
|
tar -zxf Pygments-0.11.1.tar.gz
|
|
cd Pygments-0.11.1
|
|
python setup.py install
|
|
cd ..
|
|
|
|
echo "*** Installing ViewVC into $VIEWVC_DIR"
|
|
if [ ! -e $VIEWVC_DIR/viewvc.conf ]; then
|
|
../viewvc-install <<EOF
|
|
$VIEWVC_DIR
|
|
|
|
|
|
|
|
|
|
|
|
EOF
|
|
fi
|
|
|
|
echo "*** Writing ViewVC configuration into $VIEWVC_DIR/viewvc.conf"
|
|
for CVSROOT in $CVSROOTS; do
|
|
if [ "$vccvsroots" ]; then
|
|
vccvsroots="$vccvsroots, "
|
|
fi
|
|
vcrootname=`basename $CVSROOT`
|
|
vccvsroots="$vccvsroots$vcrootname: $CVSROOT"
|
|
done;
|
|
cat >"$VIEWVC_DIR/viewvc.conf" <<EOF
|
|
[general]
|
|
cvs_roots = $vccvsroots
|
|
root_parents = $SVNROOT : svn
|
|
cvsnt_exe_path = /usr/bin/cvsnt
|
|
mime_types_file = /etc/mime.types
|
|
address = Admin address: stas [gav-gav] custis [ru]
|
|
kv_files =
|
|
languages = en-us, ru-ru
|
|
|
|
[utilities]
|
|
rcs_dir = /usr/bin
|
|
cvsnt = /usr/bin/cvsnt
|
|
svn = /usr/bin/svn
|
|
diff = /usr/bin/diff
|
|
cvsgraph = /usr/bin/cvsgraph
|
|
|
|
[options]
|
|
allowed_views = markup, annotate, roots
|
|
authorizer = forbiddenre
|
|
checkout_magic = 0
|
|
cross_copies = 1
|
|
cvsgraph_conf = $VIEWVC_DIR/cvsgraph.conf
|
|
default_file_view = log
|
|
diff_format = h
|
|
docroot = $VIEWVC_STATIC_URI
|
|
enable_syntax_coloration = 1
|
|
generate_etags = 1
|
|
hide_attic = 1
|
|
hide_cvsroot = 1
|
|
hide_errorful_entries = 0
|
|
hr_breakable = 1
|
|
hr_funout = 0
|
|
hr_ignore_keyword_subst = 1
|
|
hr_ignore_white = 1
|
|
hr_intraline = 0
|
|
http_expiration_time = 600
|
|
limit_changes = 100
|
|
log_sort = date
|
|
mangle_email_addresses = 1
|
|
root_as_url_component = 1
|
|
short_log_len = 80
|
|
show_log_in_markup = 1
|
|
show_logs = 1
|
|
show_subdir_lastmod = 0
|
|
sort_by = file
|
|
sort_group_dirs = 1
|
|
svn_config_dir =
|
|
template_dir = templates
|
|
use_cvsgraph = 1
|
|
use_localtime = 1
|
|
use_pagesize = 0
|
|
use_rcsparse = 0
|
|
use_re_search = 0
|
|
|
|
[templates]
|
|
|
|
[cvsdb]
|
|
enabled = 1
|
|
host = $DB_HOST
|
|
socket = $DB_SOCKET
|
|
database_name = $DB
|
|
user = $DB_USER
|
|
passwd = $DB_PASSWD
|
|
readonly_user = $DB_USER
|
|
readonly_passwd = $DB_PASSWD
|
|
|
|
[vhosts]
|
|
|
|
[authz-forbidden]
|
|
forbidden =
|
|
|
|
[authz-forbiddenre]
|
|
forbiddenre = $SVN_FORBIDDENRE
|
|
|
|
[authz-svnauthz]
|
|
authzfile =
|
|
EOF
|
|
|
|
echo "*** Initializing database: $DB using $DB_USER@$DB_HOST"
|
|
$VIEWVC_DIR/bin/make-database <<EOF
|
|
$DB_HOST
|
|
$DB_USER
|
|
$DB_PASSWD
|
|
$DB
|
|
EOF
|
|
|
|
echo "*** Configuring Apache"
|
|
cat >/etc/apache2/sites-available/viewvc <<EOF
|
|
<VirtualHost *:80>
|
|
ServerName viewvc.office.custis.ru
|
|
ServerAlias viewvc
|
|
ServerAdmin sysadmins@custis.ru
|
|
ServerSignature Off
|
|
ErrorLog /var/log/apache2/viewvc-error.log
|
|
TransferLog /var/log/apache2/viewvc-access.log
|
|
LogLevel warn
|
|
# ViewVC at $VIEWVC_URI installed at $VIEWVC_DIR
|
|
DocumentRoot $VIEWVC_DIR/bin/mod_python
|
|
Alias $VIEWVC_STATIC_URI $VIEWVC_DIR/templates/docroot
|
|
Alias $VIEWVC_URI $VIEWVC_DIR/bin/mod_python/
|
|
<Location ~ ^${VIEWVC_URI_SLASH}*(\?.*)?$>
|
|
Options -Indexes
|
|
RewriteEngine On
|
|
RewriteRule .* ${VIEWVC_URI_SLASH}viewvc.py%{REQUEST_URI} [R,L]
|
|
</Location>
|
|
<Directory $VIEWVC_DIR/bin/mod_python>
|
|
Options +ExecCGI
|
|
AddHandler python-program .py
|
|
PythonHandler handler
|
|
PythonDebug Off
|
|
</Directory>
|
|
</VirtualHost>
|
|
EOF
|
|
a2enmod python
|
|
a2enmod mod_python
|
|
a2enmod rewrite
|
|
a2ensite viewvc
|
|
|
|
echo "*** Restarting Apache"
|
|
apache2ctl stop
|
|
sleep 1
|
|
apache2ctl start
|
|
|
|
echo "*** Building commit database for CVS"
|
|
for CVSROOT in $CVSROOTS; do
|
|
$VIEWVC_DIR/bin/cvsdbadmin rebuild $CVSROOT
|
|
done;
|
|
|
|
echo "*** Building commit database for Subversion repositories"
|
|
for i in `ls $SVNROOT`; do
|
|
if [ -d "$SVNROOT/$i" ]; then
|
|
$VIEWVC_DIR/bin/svndbadmin -v rebuild "$SVNROOT/$i"
|
|
fi
|
|
done;
|
|
|
|
# setup hooks for CVS
|
|
./setup-cvs-hooks "$CVSROOTS" "$VIEWVC_DIR" "$CVS_USER" "$CVS_GROUP" "$CVS_ASYNC"
|
|
|
|
# setup hooks for Subversion
|
|
./setup-svn-hooks "$SVNROOT" "$VIEWVC_DIR" "$SVN_ASYNC"
|