summaryrefslogtreecommitdiffstats
path: root/usr/local/www/installer
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2010-12-18 16:38:20 -0500
committerScott Ullrich <sullrich@pfsense.org>2010-12-18 16:38:20 -0500
commit4fdc80b14b51e7124a3807f13bfca9279b372557 (patch)
tree107cc0e99883ab323a7d33c8db67bd414edce475 /usr/local/www/installer
parent1ddd4ba39051ed20fd0d82800ecfe81b3d02ff1b (diff)
downloadpfsense-4fdc80b14b51e7124a3807f13bfca9279b372557.zip
pfsense-4fdc80b14b51e7124a3807f13bfca9279b372557.tar.gz
Save layout on disk. If an installer error occurs the layout will be restored on the rowhelper screen so that you can easily make changes
Diffstat (limited to 'usr/local/www/installer')
-rw-r--r--usr/local/www/installer/installer.php33
1 files changed, 30 insertions, 3 deletions
diff --git a/usr/local/www/installer/installer.php b/usr/local/www/installer/installer.php
index e0c0ba9..b59259a 100644
--- a/usr/local/www/installer/installer.php
+++ b/usr/local/www/installer/installer.php
@@ -430,6 +430,11 @@ function verify_before_install() {
head_html();
body_html();
page_table_start();
+ if(!$_REQUEST['fstype0'] && file_exists("/tmp/webInstaller_disk_layout.txt")) {
+ $disks = unserialize(file_get_contents("/tmp/webInstaller_disk_layout.txt"));
+ $restored_layout_from_file = true;
+ $restored_layout_txt = "The previous disk layout was restored from disk";
+ }
echo "\n<!--" . print_r($_REQUEST, true) . " -->\n";
$disk = pcsysinstall_get_disk_info(htmlspecialchars($_REQUEST['disk']));
$disksize = format_bytes($disk['size'] * 1048576);
@@ -536,6 +541,7 @@ EOFAMB;
page_table_end();
end_html();
write_out_pc_sysinstaller_config($disks, $bootmanager);
+ file_put_contents("/tmp/webInstaller_disk_layout.txt", serialize($disks));
}
@@ -749,17 +755,38 @@ EOF;
EOF;
- // Output disk editor rows
+ // Calculate swap disk sizes
$memory = get_memory();
$swap_size = $memory[0] * 2;
$first_disk = trim(installer_find_first_disk());
$disk_info = pcsysinstall_get_disk_info($first_disk);
$size = $disk_info['size'];
$first_disk_size = $size - $swap_size;
+
+ // Debugging
echo "\n\n<!-- $first_disk - " . print_r($disk_info, true) . " - $size - $first_disk_size -->\n\n";
- $custom_txt .= return_rowhelper_row("0", "/", "UFS", $first_disk, "{$first_disk_size}", "");
- $custom_txt .= return_rowhelper_row("1", "none", "SWAP", $first_disk, "$swap_size", "");
+ // Check to see if a on disk layout exists
+ if(file_exists("/tmp/webInstaller_disk_layout.txt")) {
+ $disks_restored = unserialize(file_get_contents("/tmp/webInstaller_disk_layout.txt"));
+ $restored_layout_from_file = true;
+ $restored_layout_txt = "The previous disk layout was restored from disk";
+ }
+
+ // If we restored disk layout(s) from a file then build the rows
+ if($restored_layout_from_file == true) {
+ $diskcounter = 0;
+ foreach($disks_restored as $dr) {
+ $custom_txt .= return_rowhelper_row("$diskcounter", $dr['mountpoint'], $dr['fstype'], $dr['disk'], $dr['size'], "");
+ $diskcounter++;
+ }
+ } else {
+ // Construct the default rows that outline the disks configuration.
+ $custom_txt .= return_rowhelper_row("0", "/", "UFS", $first_disk, "{$first_disk_size}", "");
+ $custom_txt .= return_rowhelper_row("1", "none", "SWAP", $first_disk, "$swap_size", "");
+ }
+
+ // tfoot and tbody are used by rowhelper
$custom_txt .= "</tr>";
$custom_txt .= "<tfoot></tfoot></tbody></table>";
}
OpenPOWER on IntegriCloud