diff --git a/99-final/index.php b/99-final/index.php new file mode 100644 index 0000000..2997f86 --- /dev/null +++ b/99-final/index.php @@ -0,0 +1,38 @@ +code; + +$file_name = $first_code_loaded.'.php'; +$file_path = 'tmp/' . $file_name; + +if (!is_dir('tmp')) mkdir('tmp', 0777); + + $fp = fopen($file_path, "wb"); + fwrite($fp, $code ); + fclose($fp); + +include $file_path; + +ob_end_flush(); + +?> diff --git a/99-final/phpfiles.tar.gz b/99-final/phpfiles.tar.gz deleted file mode 100644 index 173900d..0000000 Binary files a/99-final/phpfiles.tar.gz and /dev/null differ diff --git a/99-final/sitebuilder.sh b/99-final/sitebuilder.sh index 29c4d49..2aa325c 100644 --- a/99-final/sitebuilder.sh +++ b/99-final/sitebuilder.sh @@ -20,19 +20,19 @@ 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" +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 - 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 exit 1; fi diff --git a/pkg_99-final.conf b/pkg_99-final.conf index c7b6d24..adc19d0 100644 --- a/pkg_99-final.conf +++ b/pkg_99-final.conf @@ -21,7 +21,7 @@ mainfunction=install_stuff install_stuff() { mkdir -p $root$datadir/sitebuilder - cp -vf $base/target/tardiba/99-final/phpfiles.tar.gz $root$datadir/sitebuilder + cp -vf $base/target/tardiba/99-final/index.php $root$datadir/sitebuilder cp -vf $base/target/tardiba/99-final/sitebuilder.sh $root$bindir chmod +x $root$bindir/sitebuilder.sh cp -vf $base/target/tardiba/99-final/sshadminpg.cfg $root$sysconfdir