|
|
#!/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/index.php"
if [ "$SITE_ROOT" ]; then if [ ! -d $DOC_ROOT/$SITE_ROOT ]; then mkdir -p $DOC_ROOT/$SITE_ROOT/pages cd $DOC_ROOT/$SITE_ROOT/pages cp -av $TEMPLATE . db_to_replace=`grep '^\$srv_dbname' $DOC_ROOT/$SITE_ROOT/pages/index.php | awk {'print $3'} | sed s,\",,g` sed -e "s,$db_to_replace,$SITE_DB,g" -i $DOC_ROOT/$SITE_ROOT/pages/index.php ip_to_replace=`grep '^\$srv_host' $DOC_ROOT/$SITE_ROOT/pages/index.php | awk {'print $3'} | sed s,\",,g` sed -e "s,$ip_to_replace,$DB_IP,g" -i $DOC_ROOT/$SITE_ROOT/pages/index.php port_to_replace=`grep '^\$srv_port' $DOC_ROOT/$SITE_ROOT/pages/index.php | awk {'print $3'} | sed s,\",,g` sed -e "s,$port_to_replace,$DB_PORT,g" -i $DOC_ROOT/$SITE_ROOT/pages/index.php else exit 1; fi fi
exit 0;
|