From ba3feae8161772a7d6b5010e2f715e0c19d8628c Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Fri, 17 Dec 2010 20:19:23 -0500 Subject: Add rowhelper support --- usr/local/www/installer/index.php | 340 ++++++++++++++++++++++++-------------- 1 file changed, 215 insertions(+), 125 deletions(-) (limited to 'usr') diff --git a/usr/local/www/installer/index.php b/usr/local/www/installer/index.php index 238a1cb..88f01f7 100644 --- a/usr/local/www/installer/index.php +++ b/usr/local/www/installer/index.php @@ -1,6 +1,6 @@ All rights reserved. @@ -58,24 +58,38 @@ switch ($_REQUEST['state']) { installer_main(); } -function write_out_pc_sysinstaller_config($disk, $fstype = "UFS+S", $swapsize = "", $encryption = false, $encpass = "", $bootmanager = "bsd") { +function write_out_pc_sysinstaller_config($disks, $bootmanager = "bsd") { $diskareas = ""; $fd = fopen("/usr/sbin/pc-sysinstall/examples/pfSense-install.cfg", "w"); if(!$fd) { return true; } - if($swapsize <> "") { - $diskareas .= "disk0-part={$fstype} 0 /\n"; - $diskareas .= "disk0-part=SWAP {$swapsize} none \n"; - } else { - $diskareas .= "disk0-part={$fstype} 0 /\n"; - } - if($encpass) - $diskareaspass = "encpass={$encpass}\n"; - if($encryption) - $diskareaspre = "disk0-part=UFS 500 /boot\n"; if($bootmanager == "") $bootmanager = "none"; + $numdisks = -1; + $lastdisk = ""; + $diskdefs = ""; + // First make sure we have a boot partition if any slices are encrypted + foreach($disks as $disksa) { + $fstype = $disksa['fstype']; + if(stristr($fstype,".eli")) + $diskareas .= "disk{$numdisks}-part=UFS 500 /boot\n"; + } + // Run through the disks and create the conf areas for pc-sysinstaller + foreach($disks as $disksa) { + $fstype = $disksa['fstype']; + $size = $disksa['size']; + $mountpoint = $disksa['mountpoint']; + $disk = $disksa['disk']; + if($disk <> $lastdisk) { + $lastdisk = $disk; + $numdisks++; + $diskdefs .= "disk{$numdisks}={$disk}\n"; + } + $diskareas .= "disk{$numdisks}-part={$fstype} {$size} {$mountpoint} \n"; + if($encpass) + $diskareas .= "encpass={$encpass}\n"; + } $config = << An error occurred. Aborting installation. Back to webInstaller'; "; + echo "\$('installerrunning').innerHTML=' An error occurred. Aborting installation. Back to webInstaller'; "; echo "\$('progressbar').style.width='100%';\n"; unlink_if_exists("/tmp/install_complete"); return; @@ -309,38 +323,6 @@ function begin_install() { if(file_exists("/tmp/install_complete")) return; unlink_if_exists("/tmp/install_complete"); - if($_REQUEST['disk']) - $disk = htmlspecialchars($_REQUEST['disk']); - else - $disk = installer_find_first_disk(); - if($_REQUEST['swapsize']) - $swapsize = $_REQUEST['swapsize']; - if($_REQUEST['bootmanager']) - $bootmanager = $_REQUEST['bootmanager']; - if(!$disk) { - 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; - } - // Handle other type of file systems - if($_REQUEST['fstype']) - $fstype = htmlspecialchars($_REQUEST['fstype']); - else - $fstype = "UFS+S"; - if(substr($_REQUEST['fstype'], -4, 4) == ".eli") { - $encryption = true; - if($_REQUEST['encpass']) - $encpass = $_REQUEST['encpass']; - else - $encpass = ""; - } else { - $encryption = false; - $encpass = ""; - } - write_out_pc_sysinstaller_config($disk, $fstype, $swapsize, $encryption, $encpass); update_installer_status_win(sprintf(gettext("Beginning installation on disk %s."),$disk)); start_installation(); } @@ -389,7 +371,7 @@ function body_html() { + +
@@ -649,7 +691,6 @@ function installer_custom() {
-
@@ -667,73 +708,115 @@ EOF; } else { // Prepare disk selection dropdown $custom_txt = << - - - -
-
Select the installation parameters for {$g['product_name']}:
-

+

+ + + + +
+ Boot manager: + + +
+
+ + + + + + + + + + + EOF; - $custom_txt .= "\n"; - $custom_txt .= ""; // File system type - $custom_txt .= "\n"; - // XXX: Convert to rowhelper. Add Ajax callbacks to verify sizes, etc. - $custom_txt .= ""; - // Disk encryption password - $custom_txt .= ""; - // Boot manager type - $custom_txt .= ""; - $custom_txt .= "
+ Mount point + + Filesysyem type + + Disk + + Size + + Encryption password + +   +
Swap size
Disk:
Filesystem type:\n"; - $custom_txt .= "
Disk encryption password:"; - $custom_txt .= ""; - $custom_txt .= "
Boot manager:"; - $custom_txt .= ""; - $custom_txt .= "

"; + $select_txt .= ""; + $custom_txt .= "{$select_txt}\n"; + $custom_txt .= ""; + $custom_txt .= "\n"; + + $custom_txt .= ""; + + $custom_txt .= ""; + $custom_txt .= ""; + $custom_txt .= ""; + + $custom_txt .= ""; + $custom_txt .= "

"; + $custom_txt .= ""; + $custom_txt .= "\"\""; + $custom_txt .= "
"; + $custom_txt .= ""; + + $custom_txt .= ""; + $custom_txt .= ""; } echo << + + EOF; page_table_end(); @@ -765,10 +855,10 @@ function installer_main() { $disk = installer_find_first_disk(); // Only enable ZFS if this exists. The install will fail otherwise. if(file_exists("/boot/gptzfsboot")) - $zfs_enabled = "Easy installation of {$g['product_name']} using the ZFS filesystem on disk {$disk}"; + $zfs_enabled = "Easy installation of {$g['product_name']} using the ZFS filesystem on disk {$disk}"; page_table_start(); echo << +
Welcome to the {$g['product_name']} webInstaller!

@@ -798,11 +888,11 @@ EOF; {$zfs_enabled}
- Easy installation of {$g['product_name']} using the UFS filesystem on disk {$disk} + Easy installation of {$g['product_name']} using the UFS filesystem on disk {$disk}
- Custom installation of {$g['product_name']} + Custom installation of {$g['product_name']}
Cancel and return to Dashboard @@ -823,4 +913,4 @@ EOF; end_html(); } -?> +?> \ No newline at end of file -- cgit v1.1