|
@ -20,19 +20,19 @@ DB_PORT="$4" |
|
|
|
|
|
|
|
|
lighttpd_config="/etc/opt/lighttpd/lighttpd.conf" |
|
|
lighttpd_config="/etc/opt/lighttpd/lighttpd.conf" |
|
|
DOC_ROOT=`grep 'simple-vhost.server-root' $lighttpd_config | awk {'print $3'} | sed 's,\",,g'` |
|
|
DOC_ROOT=`grep 'simple-vhost.server-root' $lighttpd_config | awk {'print $3'} | sed 's,\",,g'` |
|
|
TEMPLATE="/usr/share/sitebuilder/phpfiles.tar.gz" |
|
|
|
|
|
|
|
|
TEMPLATE="/usr/share/sitebuilder/index.php" |
|
|
|
|
|
|
|
|
if [ "$SITE_ROOT" ]; then |
|
|
if [ "$SITE_ROOT" ]; then |
|
|
if [ ! -d $DOC_ROOT/$SITE_ROOT ]; then |
|
|
if [ ! -d $DOC_ROOT/$SITE_ROOT ]; then |
|
|
mkdir -p $DOC_ROOT/$SITE_ROOT/pages |
|
|
mkdir -p $DOC_ROOT/$SITE_ROOT/pages |
|
|
cd $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 |
|
|
|
|
|
|
|
|
cp -av $TEMPLATE . |
|
|
|
|
|
db_to_replace=`grep '^\$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 '^\$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 '^\$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 |
|
|
else |
|
|
exit 1; |
|
|
exit 1; |
|
|
fi |
|
|
fi |
|
|