summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xusr/local/www/diag_nanobsd.php54
1 files changed, 33 insertions, 21 deletions
diff --git a/usr/local/www/diag_nanobsd.php b/usr/local/www/diag_nanobsd.php
index 787c245..e2af6ec 100755
--- a/usr/local/www/diag_nanobsd.php
+++ b/usr/local/www/diag_nanobsd.php
@@ -47,30 +47,37 @@ $BOOT_DEVICE=trim(`/sbin/mount | /usr/bin/grep pfsense | /usr/bin/cut -d'/' -f4
$REAL_BOOT_DEVICE=trim(`/sbin/glabel list | /usr/bin/grep -B2 ufs/{$BOOT_DEVICE} | /usr/bin/head -n 1 | /usr/bin/cut -f3 -d' '`);
$BOOT_DRIVE=trim(`/sbin/glabel list | /usr/bin/grep -B2 ufs/pfsense | /usr/bin/head -n 1 | /usr/bin/cut -f3 -d' ' | /usr/bin/cut -d's' -f1`);
-// Detect which slice is active and set information.
-if(strstr($REAL_BOOT_DEVICE, "s1")) {
- $SLICE="2";
- $OLDSLICE="1";
- $TOFLASH="{$BOOT_DRIVE}s{$SLICE}";
- $COMPLETE_PATH="{$BOOT_DRIVE}s{$SLICE}a";
- $COMPLETE_BOOT_PATH="{$BOOT_DRIVE}s{$OLDSLICE}";
- $GLABEL_SLICE="pfsense1";
- $UFS_ID="1";
- $OLD_UFS_ID="0";
- $BOOTFLASH="{$BOOT_DRIVE}s{$OLDSLICE}";
+function detect_slice_info() {
+ global $SLICE, $OLDSLICE, $TOFLASH, $COMPLETE_PATH, $COMPLETE_BOOT_PATH;
+ global $GLABEL_SLIZE, $UFS_ID, $OLD_UFS_ID, $BOOTFLASH;
+ // Detect which slice is active and set information.
+ if(strstr($REAL_BOOT_DEVICE, "s1")) {
+ $SLICE="2";
+ $OLDSLICE="1";
+ $TOFLASH="{$BOOT_DRIVE}s{$SLICE}";
+ $COMPLETE_PATH="{$BOOT_DRIVE}s{$SLICE}a";
+ $COMPLETE_BOOT_PATH="{$BOOT_DRIVE}s{$OLDSLICE}";
+ $GLABEL_SLICE="pfsense1";
+ $UFS_ID="1";
+ $OLD_UFS_ID="0";
+ $BOOTFLASH="{$BOOT_DRIVE}s{$OLDSLICE}";
-} else {
- $SLICE="1";
- $OLDSLICE="2";
- $TOFLASH="{$BOOT_DRIVE}s{$SLICE}";
- $COMPLETE_PATH="{$BOOT_DRIVE}s{$SLICE}a";
- $COMPLETE_BOOT_PATH="{$BOOT_DRIVE}s{$OLDSLICE}";
- $GLABEL_SLICE="pfsense0";
- $UFS_ID="0";
- $OLD_UFS_ID="1";
- $BOOTFLASH="{$BOOT_DRIVE}s{$OLDSLICE}";
+ } else {
+ $SLICE="1";
+ $OLDSLICE="2";
+ $TOFLASH="{$BOOT_DRIVE}s{$SLICE}";
+ $COMPLETE_PATH="{$BOOT_DRIVE}s{$SLICE}a";
+ $COMPLETE_BOOT_PATH="{$BOOT_DRIVE}s{$OLDSLICE}";
+ $GLABEL_SLICE="pfsense0";
+ $UFS_ID="0";
+ $OLD_UFS_ID="1";
+ $BOOTFLASH="{$BOOT_DRIVE}s{$OLDSLICE}";
+ }
}
+// Survey slice info
+detect_slice_info();
+
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC" onload="<?=$jsevents["body"]["onload"];?>">
@@ -125,6 +132,9 @@ EOF;
exec("sysctl kern.geom.debugflags=0");
conf_mount_ro();
$savemsg = "The boot slice has been set to {$BOOT_DRIVE} {$AGLABEL_SLICE}";
+ // Survey slice info
+ detect_slice_info();
+
}
if($_POST['destslice']) {
@@ -155,6 +165,8 @@ EOF;
exec("/sbin/umount /tmp/{$GLABEL_SLICE}");
}
exec("sysctl kern.geom.debugflags=0");
+ // Re-Survey slice info
+ detect_slice_info();
}
if ($savemsg)
OpenPOWER on IntegriCloud