Tardiba - The Tasmanian Devil Database Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

41 lines
1.7 KiB

#!/bin/bash
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: target/tardiba/99-final/sitebuilder.sh
# Copyright (C) 2007 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
SITE_ROOT="$1"
SITE_DB="$2"
DB_IP="$3"
DB_PORT="$4"
lighttpd_config="/etc/opt/lighttpd/lighttpd.conf"
DOC_ROOT=`grep 'simple-vhost.server-root' $lighttpd_config | awk {'print $3'} | sed 's,\",,g'`
TEMPLATE="/usr/share/sitebuilder/phpfiles.tar.gz"
if [ "$SITE_ROOT" ]; then
if [ ! -d $DOC_ROOT/$SITE_ROOT ]; then
mkdir -p $DOC_ROOT/$SITE_ROOT/pages
cd $DOC_ROOT/$SITE_ROOT/pages
tar xzvf $TEMPLATE
db_to_replace=`grep '^\$dbname' $DOC_ROOT/$SITE_ROOT/pages/dbconnection.php | awk {'print $3'} | sed s,\",,g`
sed -e "s,$db_to_replace,$SITE_DB,g" -i $DOC_ROOT/$SITE_ROOT/pages/dbconnection.php
ip_to_replace=`grep '^\$host' $DOC_ROOT/$SITE_ROOT/pages/dbconnection.php | awk {'print $3'} | sed s,\",,g`
sed -e "s,$ip_to_replace,$DB_IP,g" -i $DOC_ROOT/$SITE_ROOT/pages/dbconnection.php
port_to_replace=`grep '^\$port' $DOC_ROOT/$SITE_ROOT/pages/dbconnection.php | awk {'print $3'} | sed s,\",,g`
sed -e "s,$port_to_replace,$DB_PORT,g" -i $DOC_ROOT/$SITE_ROOT/pages/dbconnection.php
else
exit 1;
fi
fi
exit 0;