0) { $mysqlPassword = " --password=".escapeshellarg(MYSQL_PASSWORD)." "; } else { $mysqlPassword = " "; } // Drop any existing database here system('echo "DROP DATABASE IF EXISTS '.$mysqlDatabase.';" | mysql --user='.$mysqlUsername.$mysqlPassword); // Create a new database system('echo "CREATE DATABASE '.$mysqlDatabase.';" | mysql --user='.$mysqlUsername.$mysqlPassword); // Import the database dump into that database system('mysql --user='.$mysqlUsername.$mysqlPassword.$mysqlDatabase.' < gentoaster.sql'); } else { die("SQL file not found, check GENTOASTER_PATH\n"); } // Add the initscript for the daemon echo "Adding initscript symlink\n"; system("rm -f /etc/init.d/gentoaster"); system("ln -s ".GENTOASTER_PATH."/gentoaster /etc/init.d/gentoaster"); system("chmod +x ".GENTOASTER_PATH."/gentoaster"); echo "Starting Gentoaster daemon\n"; exec("/etc/init.d/gentoaster start"); echo "If you didn't see any errors, the install was successful\n"; echo "Try visiting the site at ".GENTOASTER_URL." to make sure everything works\n";