diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2009-07-05 21:55:56 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2009-07-05 21:55:56 -0400 |
commit | 935fb53e5e8078154ef0c9f4e79e7911a76f9ec4 (patch) | |
tree | 7248d1128da0a8da94801b6af699d2ad8ab2aefe | |
parent | dce5cc7cdcf0b44310c5e11dd81763ec92a699af (diff) | |
download | pfsense-935fb53e5e8078154ef0c9f4e79e7911a76f9ec4.zip pfsense-935fb53e5e8078154ef0c9f4e79e7911a76f9ec4.tar.gz |
Correct set boot slice
-rwxr-xr-x | usr/local/www/diag_nanobsd.php | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/usr/local/www/diag_nanobsd.php b/usr/local/www/diag_nanobsd.php index e57ad5c..3b311bb 100755 --- a/usr/local/www/diag_nanobsd.php +++ b/usr/local/www/diag_nanobsd.php @@ -85,18 +85,38 @@ if($_POST['bootslice']) { EOF; for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); } ob_implicit_flush(1); - exec("gpart set -a active -i {$SLICE} {$BOOT_DRIVE}"); - exec("/usr/sbin/boot0cfg -s {$SLICE} -v /dev/{$BOOT_DRIVE}"); - exec("/bin/mkdir /tmp/{$GLABEL_SLICE}"); - exec("/sbin/mount /dev/ufs/{$GLABEL_SLICE} /tmp/{$GLABEL_SLICE}"); - exec("/bin/cp /etc/fstab /tmp/{$GLABEL_SLICE}/etc/fstab"); - $status = exec("sed -i \"\" \"s/pfsense{$OLD_UFS_ID}/pfsense{$UFS_ID}/g\" /tmp/{$GLABEL_SLICE}/etc/fstab"); + if(strstr($_POST['bootslice'], "s1")) { + $ASLICE="2"; + $AOLDSLICE="1"; + $ATOFLASH="{$BOOT_DRIVE}s{$SLICE}"; + $ACOMPLETE_PATH="{$BOOT_DRIVE}s{$SLICE}a"; + $AGLABEL_SLICE="pfsense1"; + $AUFS_ID="1"; + $AOLD_UFS_ID="0"; + $ABOOTFLASH="{$BOOT_DRIVE}s{$OLDSLICE}"; + } else { + $ASLICE="1"; + $AOLDSLICE="2"; + $ATOFLASH="{$BOOT_DRIVE}s{$SLICE}"; + $ACOMPLETE_PATH="{$BOOT_DRIVE}s{$SLICE}a"; + $AGLABEL_SLICE="pfsense0"; + $AUFS_ID="0"; + $AOLD_UFS_ID="1"; + $ABOOTFLASH="{$BOOT_DRIVE}s{$OLDSLICE}"; + } + exec("gpart set -a active -i {$ASLICE} {$ABOOT_DRIVE}"); + exec("/usr/sbin/boot0cfg -s {$ASLICE} -v /dev/{$ABOOT_DRIVE}"); + exec("/bin/mkdir /tmp/{$AGLABEL_SLICE}"); + exec("/sbin/fsck_ufs -y /dev/{$ACOMPLETE_PATH}"); + exec("/sbin/mount /dev/ufs/{$AGLABEL_SLICE} /tmp/{$AGLABEL_SLICE}"); + exec("/bin/cp /etc/fstab /tmp/{$AGLABEL_SLICE}/etc/fstab"); + $status = exec("sed -i \"\" \"s/pfsense{$AOLD_UFS_ID}/pfsense{$AUFS_ID}/g\" /tmp/{$AGLABEL_SLICE}/etc/fstab"); if($status) { file_notice("UpgradeFailure","Something went wrong when trying to update the fstab entry. Aborting upgrade."); - exec("/sbin/umount /tmp/{$GLABEL_SLICE}"); + exec("/sbin/umount /tmp/{$AGLABEL_SLICE}"); } - exec("/sbin/umount /tmp/{$GLABEL_SLICE}"); - $savemsg = "The boot slice has been set to {$BOOT_DRIVE} {$SLICE}"; + exec("/sbin/umount /tmp/{$AGLABEL_SLICE}"); + $savemsg = "The boot slice has been set to {$ABOOT_DRIVE} {$ASLICE}"; } if($_POST['destslice']) { |