pedro_morgan
2007-08-20 dcff5718f345f55f7ea81f18d1f086facde4eacf
install/install.php
@@ -47,28 +47,40 @@
 \___/\____/\_|      \____/\___/|_| |_|_| |_|\__, |
                                              __/ |
                                             |___/ ";
echo "\n\n>> sInitial configuration  \n\n";
echo "\n".str_repeat('-',80)."\n";
echo "\n\n>> Initial configuration  \n\n";
//** Include the library with the basic installer functions
require_once('lib/install.lib.php');
require_once('options.conf.php');
//** Include the base class of the installer class
require_once('lib/installer_base.lib.php');
include_once('options.conf.php');
$distname = get_distname();
//** Include the distribution specific installer class library and configuration
include_once('dist/lib/'.$conf['distname'].'.lib.php');
include_once('dist/conf/'.$conf['distname'].'.conf.php');
//TODO: this is not there ????
$distname = get_distname();
//** Copt the $dist created in dist/conf/foo to global var
$conf['dist'] = $dist;
//** Lets go !
define('ISPC_LOG_FILE', '/var/log/ispconfig_install.log');
//****************************************************************************************************
//** Installer Interface
//****************************************************************************************************
$inst = new installer();
swriteln($inst->lng('Following will be a few questions for primary configuration so be careful please',"\n\n"));
swriteln($inst->lng('    Following will be a few questions for primary configuration so be careful.'));
swriteln($inst->lng('    Default values are in [brackets] and can be accepted with <ENTER>.'));
swriteln($inst->lng('    Tap in "quit" (without the quotes) to stop the installer.'."\n\n"));
//** Check log file is writable (probably not root or sudo)
if(!is_writable(ISPC_LOG_FILE)){
    die("ERROR: Cannot write to the log file '".ISPC_LOG_FILE."'. Are you root or sudo ?\n\n");
}
//** Select the language
$conf['language'] = $inst->simple_query('Select language', array('en','de'), 'en');
@@ -76,10 +88,11 @@
//** Select installation mode
$install_mode = $inst->simple_query('Installation mode', array('Standard','Expert'), 'Standard');
//** Get the hostname
$tmp_out = array();
exec('hostname -f', $tmp_out);
$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server', $tmp_out[0]);
$conf['hostname'] = $inst->free_query('Full qualified hostname (FQDN) of the server, eg foo.example.com ', $tmp_out[0]);
unset($tmp_out);
//** Get MySQL root credentials
@@ -88,12 +101,14 @@
   $tmp_mysql_server_host = $inst->free_query('MySQL server hostname', $conf['mysql']['host']);
   $tmp_mysql_server_admin_user = $inst->free_query('MySQL root username', $conf['mysql']['admin_user']);
   $tmp_mysql_server_admin_password = $inst->free_query('MySQL root password', $conf['mysql']['admin_password']);
    $tmp_mysql_server_database = $inst->free_query('MySQL database to create', $conf['mysql']['database']);
   
   //* Initialize the MySQL server connection
   if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
      $conf['mysql']['host'] = $tmp_mysql_server_host;
      $conf['mysql']['admin_user'] = $tmp_mysql_server_admin_user;
      $conf['mysql']['admin_password'] = $tmp_mysql_server_admin_password;
        $conf['mysql']['database'] = $tmp_mysql_server_database;
      $finished = true;
   } else {
      swriteln($inst->lng('Unable to connect to mysql server').' '.mysql_error());