|
|
@ -0,0 +1,41 @@ |
|
|
|
#!/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 '^\$dbname' $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 |
|
|
|
else |
|
|
|
exit 1; |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
exit 0; |