Commit 20218c0b authored by mdshort's avatar mdshort

Updated installer to make it more portable.

parent 313e3365
<?php
$conf["language"] = "en";
$conf["distname"] = "debian40";
$conf["hostname"] = "server1.example.com"; // Full hostname
$conf["ispconfig_install_dir"] = "/usr/local/ispconfig";
$conf["ispconfig_config_dir"] = "/usr/local/ispconfig";
$conf["server_id"] = 1;
/*
Distribution specific settings
*/
$conf["dist_init_scripts"] = "/etc/init.d";
$conf["dist_runlevel"] = "/etc";
$conf["dist_shells"] = "/etc/shells";
$conf["dist_cron_tab"] = "/var/spool/cron/crontabs/root";
// Main
$dist["init_scripts"] = "/etc/init.d";
$dist["runlevel"] = "/etc";
$dist["shells"] = "/etc/shells";
$dist["cron_tab"] = "/var/spool/cron/crontabs/root";
$dist["pam"] = "/etc/pam.d";
// MySQL
$dist["mysql"]["init_script"] = "mysql";
// Apache
$conf["dist_apache_user"] = "www-data";
$conf["dist_apache_group"] = "www-data";
$conf["dist_apache_init_script"] = "apache2";
$conf["dist_apache_version"] = "2.2";
$conf["dist_apache_vhost_conf_dir"] = "/etc/apache2/sites-available";
$conf["dist_apache_vhost_conf_enabled_dir"] = "/etc/apache2/sites-enabled";
$dist["apache"]["user"] = "www-data";
$dist["apache"]["group"] = "www-data";
$dist["apache"]["init_script"] = "apache2";
$dist["apache"]["version"] = "2.2";
$dist["apache"]["vhost_dist_dir"] = "/etc/apache2/sites-available";
$dist["apache"]["vhost_dist_enabled_dir"] = "/etc/apache2/sites-enabled";
// Postfix
$conf["dist_postfix_config_dir"] = "/etc/postfix";
$conf["dist_postfix_username"] = "postfix";
$conf["dist_postfix_groupname"] = "postfix";
$conf["dist_postfix_vmail_userid"] = "5000";
$conf["dist_postfix_vmail_username"] = "vmail";
$conf["dist_postfix_vmail_groupid"] = "5000";
$conf["dist_postfix_vmail_groupname"] = "vmail";
$conf["dist_postfix_vmail_mailbox_base"] = "/home/vmail";
$dist["postfix"]["config_dir"] = "/etc/postfix";
$dist["postfix"]["init_script"] = "postfix";
$dist["postfix"]["user"] = "postfix";
$dist["postfix"]["group"] = "postfix";
$dist["postfix"]["vmail_userid"] = "5000";
$dist["postfix"]["vmail_username"] = "vmail";
$dist["postfix"]["vmail_groupid"] = "5000";
$dist["postfix"]["vmail_groupname"] = "vmail";
$dist["postfix"]["vmail_mailbox_base"] = "/home/vmail";
// Getmail
$conf["dist_getmail_config_dir"] = "/etc/getmail";
$conf["dist_getmail_program"] = "/usr/bin/getmail";
$dist["getmail"]["config_dir"] = "/etc/getmail";
$dist["getmail"]["program"] = "/usr/bin/getmail";
// Courier
$conf["dist_courier_config_dir"] = "/etc/courier";
$dist["courier"]["config_dir"] = "/etc/courier";
$dist["courier"]["courier-authdaemon"] = "courier-authdaemon";
$dist["courier"]["courier-imap"] = "courier-imap";
$dist["courier"]["courier-imap-ssl"] = "courier-imap-ssl";
$dist["courier"]["courier-pop"] = "courier-pop";
$dist["courier"]["courier-pop-ssl"] = "courier-pop-ssl";
// SASL
$dist["saslauthd"]["config"] = "/etc/default/saslauthd";
$dist["saslauthd"]["init_script"] = "saslauthd";
// Amavisd
$conf["dist_amavis_config_dir"] = "/etc/amavis";
$dist["amavis"]["config_dir"] = "/etc/amavis";
$dist["amavis"]["init_script"] = "amavis";
// ClamAV
$dist["clamav"]["init_script"] = "clamav-daemon";
// Pureftpd
$conf["dist_pureftpd_config_dir"] = "/etc/pure-ftpd/db";
$dist["pureftpd"]["config_dir"] = "/etc/pure-ftpd";
$dist["pureftpd"]["init_script"] = "pure-ftpd-mysql";
// MyDNS
$conf["dist_mydns_config_dir"] = "/etc";
/*
MySQL Database settings
*/
$conf["mysql_server_host"] = "localhost";
$conf["mysql_server_ip"] = "127.0.0.1";
$conf["mysql_server_port"] = "3306";
$conf["mysql_server_database"] = "dbispconfig";
$conf["mysql_server_admin_user"] = "root";
$conf["mysql_server_admin_password"] = "";
$conf["mysql_server_ispconfig_user"] = "ispconfig";
$conf["mysql_server_ispconfig_password"] = "5sDrewBhk";
$dist["mydns"]["config_dir"] = "/etc";
$dist["mydns"]["init_script"] = "mydns";
?>
\ No newline at end of file
?>
<?php
/*
Distribution specific settings
*/
// Main
$dist["init_scripts"] = "/etc/init.d";
$dist["runlevel"] = "/etc";
$dist["shells"] = "/etc/shells";
$dist["cron_tab"] = "/var/spool/cron/crontabs/root";
$dist["pam"] = "/etc/pam.d";
// MySQL
$dist["mysql"]["init_script"] = "mysql";
// Apache
$dist["apache"]["user"] = "apache";
$dist["apache"]["group"] = "apache";
$dist["apache"]["init_script"] = "apache2";
$dist["apache"]["version"] = "2.2";
$dist["apache"]["vhost_dist_dir"] = "/etc/apache2/vhosts.d";
$dist["apache"]["vhost_dist_enabled_dir"] = "/etc/apache2/vhosts.d";
// Postfix
$dist["postfix"]["config_dir"] = "/etc/postfix";
$dist["postfix"]["init_script"] = "postfix";
$dist["postfix"]["user"] = "postfix";
$dist["postfix"]["group"] = "postfix";
$dist["postfix"]["vmail_userid"] = "5000";
$dist["postfix"]["vmail_username"] = "vmail";
$dist["postfix"]["vmail_groupid"] = "5000";
$dist["postfix"]["vmail_groupname"] = "vmail";
$dist["postfix"]["vmail_mailbox_base"] = "/home/vmail";
// Getmail
$dist["getmail"]["config_dir"] = "/etc/getmail";
$dist["getmail"]["program"] = "/usr/bin/getmail";
// Courier
$dist["courier"]["config_dir"] = "/etc/courier";
$dist["courier"]["courier-authdaemon"] = "courier-authlib";
$dist["courier"]["courier-imap"] = "courier-imapd";
$dist["courier"]["courier-imap-ssl"] = "courier-imapd-ssl";
$dist["courier"]["courier-pop"] = "courier-pop3d";
$dist["courier"]["courier-pop-ssl"] = "courier-pop3d-ssl";
// SASL
$dist["saslauthd"]["config"] = "/etc/default/saslauthd";
$dist["saslauthd"]["init_script"] = "saslauthd";
// Amavisd
$dist["amavis"]["config_dir"] = "/etc/amavis";
$dist["amavis"]["init_script"] = "amavisd";
// ClamAV
$dist["clamav"]["init_script"] = "clamd";
// Pureftpd
$dist["pureftpd"]["config_dir"] = "/etc/pure-ftpd";
$dist["pureftpd"]["init_script"] = "pure-ftpd";
// MyDNS
$dist["mydns"]["config_dir"] = "/etc";
$dist["mydns"]["init_script"] = "mydns";
?>
<?php
/*
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of ISPConfig nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
class installer extends installer_base {
}
?>
\ No newline at end of file
......@@ -42,12 +42,15 @@ require_once('lib/install.lib.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/'.$distname.'.lib.php');
include_once('dist/conf/'.$distname.'.conf.php');
include_once('dist/lib/'.$conf['distname'].'.lib.php');
include_once('dist/conf/'.$conf['distname'].'.conf.php');
$conf['dist'] = $dist;
$inst = new installer();
......@@ -72,15 +75,15 @@ unset($tmp_out);
// Get MySQL root password
$finished = false;
do {
$tmp_mysql_server_host = $inst->free_query('MySQL server hostname',$conf["mysql_server_host"]);
$tmp_mysql_server_admin_user = $inst->free_query('MySQL root username',$conf["mysql_server_admin_user"]);
$tmp_mysql_server_admin_password = $inst->free_query('MySQL root password',$conf["mysql_server_admin_password"]);
$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"]);
// Initialize the MySQL server connection
if(@mysql_connect($tmp_mysql_server_host, $tmp_mysql_server_admin_user, $tmp_mysql_server_admin_password)) {
$conf["mysql_server_host"] = $tmp_mysql_server_host;
$conf["mysql_server_admin_user"] = $tmp_mysql_server_admin_user;
$conf["mysql_server_admin_password"] = $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;
$finished = true;
} else {
swriteln($inst->lng("Unable to connect to mysql server").' '.mysql_error());
......@@ -147,19 +150,19 @@ if($install_mode == 'Standard') {
$inst->install_crontab();
swriteln('Restarting services ...');
system("/etc/init.d/mysql restart");
system("/etc/init.d/postfix restart");
system("/etc/init.d/saslauthd restart");
system("/etc/init.d/amavis restart");
system("/etc/init.d/clamav-daemon restart");
system("/etc/init.d/courier-authdaemon restart");
system("/etc/init.d/courier-imap restart");
system("/etc/init.d/courier-imap-ssl restart");
system("/etc/init.d/courier-pop restart");
system("/etc/init.d/courier-pop-ssl restart");
system("/etc/init.d/apache2 restart");
system("/etc/init.d/pure-ftpd-mysql restart");
system("/etc/init.d/mydns restart");
system($conf['dist']["init_scripts"].'/'.$conf['dist']['mysql']['init_script'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['postfix']['init_script'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['saslauthd']['init_script'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['amavis']['init_script'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['clamav']['init_script'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['courier']['courier-authdaemon'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['courier']['courier-imap'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['courier']['courier-imap-ssl'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['courier']['courier-pop'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['courier']['courier-pop-ssl'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['apache']['init_script'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['pureftpd']['init_script'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['mydns']['init_script'].' restart');
} else {
......@@ -198,29 +201,29 @@ if($install_mode == 'Standard') {
swriteln('Configuring Getmail');
$inst->configure_getmail();
system("/etc/init.d/postfix restart");
system("/etc/init.d/saslauthd restart");
system("/etc/init.d/amavis restart");
system("/etc/init.d/clamav-daemon restart");
system("/etc/init.d/courier-authdaemon restart");
system("/etc/init.d/courier-imap restart");
system("/etc/init.d/courier-imap-ssl restart");
system("/etc/init.d/courier-pop restart");
system("/etc/init.d/courier-pop-ssl restart");
system($conf['dist']["init_scripts"].'/'.$conf['dist']['postfix']['init_script'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['saslauthd']['init_script'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['amavis']['init_script'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['clamav']['init_script'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['courier']['courier-authdaemon'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['courier']['courier-imap'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['courier']['courier-imap-ssl'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['courier']['courier-pop'].' restart');
system($conf['dist']["init_scripts"].'/'.$conf['dist']['courier']['courier-pop-ssl'].' restart');
}
if(strtolower($inst->simple_query('Configure FTP Server',array('y','n'),'y')) == 'y') {
// Configure Pureftpd
swriteln('Configuring Pureftpd');
$inst->configure_pureftpd();
system("/etc/init.d/pure-ftpd-mysql restart");
system($conf['dist']["init_scripts"].'/'.$conf['dist']['pureftpd']['init_script'].' restart');
}
if(strtolower($inst->simple_query('Configure DNS Server',array('y','n'),'y')) == 'y') {
// Configure MyDNS
swriteln('Configuring MyDNS');
$inst->configure_mydns();
system("/etc/init.d/mydns restart");
system($conf['dist']["init_scripts"].'/'.$conf['dist']['mydns']['init_script'].' restart');
}
if(strtolower($inst->simple_query('Configure Apache Server',array('y','n'),'y')) == 'y') {
......@@ -237,8 +240,7 @@ if($install_mode == 'Standard') {
// Configure ISPConfig
swriteln('Installing Crontab');
$inst->install_crontab();
system("/etc/init.d/apache2 restart");
system($conf['dist']["init_scripts"].'/'.$conf['dist']['apache']['init_script'].' restart');
}
......@@ -248,4 +250,4 @@ if($install_mode == 'Standard') {
echo "Installation finished.\n";
?>
\ No newline at end of file
?>
......@@ -36,7 +36,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
function get_distname() {
$distname = 'debian40';
$distname = $conf['distname'];
return $distname;
}
......@@ -378,4 +378,4 @@ echo "Argument $i : $argv[$i] \n";
?>
\ No newline at end of file
?>
This diff is collapsed.
......@@ -48,10 +48,10 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{
global $conf;
$this->dbHost = $conf["mysql_server_host"];
//$this->dbName = $conf["mysql_server_database"];
$this->dbUser = $conf["mysql_server_admin_user"];
$this->dbPass = $conf["mysql_server_admin_password"];
$this->dbHost = $conf["mysql"]["host"];
//$this->dbName = $conf["mysql"]["database"];
$this->dbUser = $conf["mysql"]["admin_user"];
$this->dbPass = $conf["mysql"]["admin_password"];
//$this->connect();
}
......@@ -496,4 +496,4 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
?>
\ No newline at end of file
?>
<?php
/*
Installation Options
*/
$conf["language"] = "en";
$conf["distname"] = "debian40";
$conf["hostname"] = "server1.example.com"; // Full hostname
$conf["ispconfig_install_dir"] = "/usr/local/ispconfig";
$conf["ispconfig_config_dir"] = "/usr/local/ispconfig";
$conf["server_id"] = 1;
/*
MySQL Database settings
*/
$conf["mysql"]["host"] = "localhost";
$conf["mysql"]["ip"] = "127.0.0.1";
$conf["mysql"]["port"] = "3306";
$conf["mysql"]["database"] = "dbispconfig";
$conf["mysql"]["admin_user"] = "root";
$conf["mysql"]["admin_password"] = "";
$conf["mysql"]["ispconfig_user"] = "ispconfig";
$conf["mysql"]["ispconfig_password"] = "5sDrewBhk";
?>
......@@ -18,6 +18,8 @@ NameVirtualHost *:8080
<Directory /usr/local/ispconfig/interface/web/>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/error.log
......
......@@ -38,6 +38,8 @@ require_once('lib/install.lib.php');
// Include the base class of the installer class
require_once('lib/installer_base.lib.php');
include_once("options.conf.php");
$conf['dist'] = $dist;
$distname = get_distname();
include_once("/usr/local/ispconfig/server/lib/config.inc.php");
......@@ -50,10 +52,10 @@ include_once('dist/lib/'.$distname.'.lib.php');
include_once('dist/conf/'.$distname.'.conf.php');
// Set the mysql login information
$conf["mysql_server_host"] = $conf_old["db_host"];
$conf["mysql_server_database"] = $conf_old["db_database"];
$conf["mysql_server_ispconfig_user"] = $conf_old["db_user"];
$conf["mysql_server_ispconfig_password"] = $conf_old["db_password"];
$conf["mysql"]["host"] = $conf_old["db_host"];
$conf["mysql"]["database"] = $conf_old["db_database"];
$conf["mysql"]["ispconfig_user"] = $conf_old["db_user"];
$conf["mysql"]["ispconfig_password"] = $conf_old["db_password"];
$inst = new installer();
......@@ -71,7 +73,7 @@ $inst->db = new db();
// Database update is a bit brute force and should be rebuild later ;)
// export the current database data
if($conf["mysql_server_admin_password"] != '') {
if($conf["mysql"]["admin_password"] != '') {
system("mysqldump -h $conf[mysql_server_host] -u $conf[mysql_server_admin_user] -p$conf[mysql_server_admin_password] -c -t --add-drop-table --all --quick $conf[mysql_server_database] > existing_db.sql");
} else {
system("mysqldump -h $conf[mysql_server_host] -u $conf[mysql_server_admin_user] -c -t --add-drop-table --all --quick $conf[mysql_server_database] > existing_db.sql");
......@@ -81,7 +83,7 @@ if($conf["mysql_server_admin_password"] != '') {
// Delete the old database
exec("/etc/init.d/mysql stop");
sleep(3);
if($conf["mysql_server_database"] != '') exec("rm -rf /var/lib/mysql/".$conf["mysql_server_database"]);
if($conf["mysql"]["database"] != '') exec("rm -rf /var/lib/mysql/".$conf["mysql"]["database"]);
exec("/etc/init.d/mysql start");
sleep(5);
......@@ -95,7 +97,7 @@ foreach($db_tables as $table) {
}
// load old data back into database
if($conf["mysql_server_admin_password"] != '') {
if($conf["mysql"]["admin_password"] != '') {
system("mysql -h $conf[mysql_server_host] -u $conf[mysql_server_admin_user] -p$conf[mysql_server_admin_password] $conf[mysql_server_database] < existing_db.sql");
} else {
system("mysql -h $conf[mysql_server_host] -u $conf[mysql_server_admin_user] $conf[mysql_server_database] < existing_db.sql");
......@@ -171,4 +173,4 @@ system("/etc/init.d/mydns restart");
echo "Update finished.\n";
?>
\ No newline at end of file
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment