mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
Correct set boot slice
This commit is contained in:
parent
dce5cc7cdc
commit
935fb53e5e
@ -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']) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user