diff --git a/usr/local/www/installer.php b/usr/local/www/installer.php index bdf933016f..9607116fbb 100644 --- a/usr/local/www/installer.php +++ b/usr/local/www/installer.php @@ -32,12 +32,6 @@ require("guiconfig.inc"); define('PC_SYSINSTALL', '/PCBSD/pc-sysinstall/pc-sysinstall'); -// Handle other type of file systems -if($_REQUEST['fstype']) - $fstype = strtoupper($_REQUEST['fstype']); -else - $fstype = "UFS+S"; - if($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") { Header("Location: /index.php"); exit; @@ -45,18 +39,24 @@ if($g['platform'] == "pfSense" or $g['platform'] == "nanobsd") { // Main switch dispatcher switch ($_REQUEST['state']) { - case "quickeasyinstall": - quickeasyinstall_gui(); - break; case "update_installer_status": update_installer_status(); exit; + case "custominstall": + installer_custom(); + exit; + case "begin_install": + installing_gui(); + begin_install(); + exit; + case "verify_before_install": + verify_before_install(); + exit; default: installer_main(); } -function write_out_pc_sysinstaller_config($disk) { - global $fstype; +function write_out_pc_sysinstaller_config($disk, $fstype = "ufs") { $fd = fopen("/PCBSD/pc-sysinstall/examples/pfSense-install.cfg", "w"); if(!$fd) { return true; @@ -240,6 +240,7 @@ function update_installer_status() { echo "\$('progressbar').style.width='{$progress}%';\n"; if(file_exists("/tmp/install_complete")) { echo "\$('installerrunning').innerHTML=' Installation completed. Please reboot to continue';\n"; + echo "\$('pbdiv').fade();\n"; unlink_if_exists("/tmp/installer.sh"); file_put_contents("/tmp/installer_installer_running", "finished"); } @@ -252,19 +253,29 @@ function update_installer_status_win($status) { echo ""; } -function begin_quick_easy_install() { - global $g, $fstype; +function begin_install() { + global $g; if(file_exists("/tmp/install_complete")) return; unlink_if_exists("/tmp/install_complete"); - $disk = installer_find_first_disk(); + if($_REQUEST['disk']) + $disk = $_REQUEST['disk']; + else + $disk = installer_find_first_disk(); if(!$disk) { - // XXX: hide progress bar + echo ""; $savemsg = gettext("Could not find a suitable disk for installation"); update_installer_status_win(gettext("Could not find a suitable disk for installation.")); return; } - write_out_pc_sysinstaller_config($disk); + // Handle other type of file systems + if($_REQUEST['fstype']) + $fstype = strtoupper($_REQUEST['fstype']); + else + $fstype = "UFS+S"; + write_out_pc_sysinstaller_config($disk, $fstype); update_installer_status_win(sprintf(gettext("Beginning installation on disk %s."),$disk)); start_installation(); } @@ -376,7 +387,52 @@ EOF; end_html(); } -function quickeasyinstall_gui() { +function verify_before_install() { + global $g, $fstype; + head_html(); + body_html(); + page_table_start(); + echo << + + + + + + + + + + + + + + + + Please verify parameters before we begin installation: + + Target Disk:{$_REQUEST['disk']} + Filesystem type:{$_REQUEST['fstype']} + + + + + + + + + + + + + + +EOF; + page_table_end(); + end_html(); +} + +function installing_gui() { global $g, $fstype; head_html(); body_html(); @@ -407,24 +463,26 @@ function quickeasyinstall_gui() { - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -444,7 +502,6 @@ function quickeasyinstall_gui() { EOF; page_table_end(); end_html(); - begin_quick_easy_install(); } function page_table_start() { @@ -487,15 +544,10 @@ function installer_custom() { unlink("/tmp/.pc-sysinstall/pc-sysinstall.log"); head_html(); body_html(); - // Only enable ZFS if this exists. The install will fail otherwise. - if(file_exists("/boot/gptzfsboot")) - $zfs_enabled = "or ZFS "; - $disk = installer_find_first_disk(); - if(!$disk) - echo gettext("WARNING: Could not find any suitable disks for installation."); page_table_start(); echo << + + Welcome to the {$g['product_name']} PCSysInstaller! @@ -507,17 +559,43 @@ function installer_custom() { - Please select an installer option to begin: - Rescue config.xml - Install {$g['product_name']} using the UFS - {$zfs_enabled} - filesystem. - + + Probing disks, please wait... + +EOF; + $disks = installer_find_all_disks(); + if(!$disks) { + $custom_txt = gettext("WARNING: Could not find any suitable disks for installation."); + } else { + // Prepare disk selection dropdown + $custom_txt = "Disk: \n"; + foreach($disks as $disk) + $custom_txt .= "{$disk['disk']} - {$disk['desc']}\n"; + $custom_txt .= "\n"; + // Prepare disk types + $custom_txt .= "Filesystem type: \n"; + $custom_txt .= "UFS\n"; + if(file_exists("/boot/gptzfsboot")) + $custom_txt .= "ZFS\n"; + $custom_txt .= "\n"; + } + echo << + \$('loadingdiv').fade(); + + + {$custom_txt} + + + @@ -540,7 +618,7 @@ function installer_main() { body_html(); // Only enable ZFS if this exists. The install will fail otherwise. if(file_exists("/boot/gptzfsboot")) - $zfs_enabled = "or ZFS "; + $zfs_enabled = "Easy installation of {$g['product_name']} using the ZFS filesystem"; $disk = installer_find_first_disk(); if(!$disk) echo gettext("WARNING: Could not find any suitable disks for installation."); @@ -564,11 +642,11 @@ function installer_main() { - Rescue config.xml - Install {$g['product_name']} using the UFS - {$zfs_enabled} - filesystem. - + Rescue config.xml + Easy installation of {$g['product_name']} using the UFS filesystem + {$zfs_enabled} + Custom installation of {$g['product_name']} +