Revision 935fb53e
Added by Scott Ullrich about 16 years ago
usr/local/www/diag_nanobsd.php | ||
---|---|---|
85 | 85 |
EOF; |
86 | 86 |
for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); } |
87 | 87 |
ob_implicit_flush(1); |
88 |
exec("gpart set -a active -i {$SLICE} {$BOOT_DRIVE}"); |
|
89 |
exec("/usr/sbin/boot0cfg -s {$SLICE} -v /dev/{$BOOT_DRIVE}"); |
|
90 |
exec("/bin/mkdir /tmp/{$GLABEL_SLICE}"); |
|
91 |
exec("/sbin/mount /dev/ufs/{$GLABEL_SLICE} /tmp/{$GLABEL_SLICE}"); |
|
92 |
exec("/bin/cp /etc/fstab /tmp/{$GLABEL_SLICE}/etc/fstab"); |
|
93 |
$status = exec("sed -i \"\" \"s/pfsense{$OLD_UFS_ID}/pfsense{$UFS_ID}/g\" /tmp/{$GLABEL_SLICE}/etc/fstab"); |
|
88 |
if(strstr($_POST['bootslice'], "s1")) { |
|
89 |
$ASLICE="2"; |
|
90 |
$AOLDSLICE="1"; |
|
91 |
$ATOFLASH="{$BOOT_DRIVE}s{$SLICE}"; |
|
92 |
$ACOMPLETE_PATH="{$BOOT_DRIVE}s{$SLICE}a"; |
|
93 |
$AGLABEL_SLICE="pfsense1"; |
|
94 |
$AUFS_ID="1"; |
|
95 |
$AOLD_UFS_ID="0"; |
|
96 |
$ABOOTFLASH="{$BOOT_DRIVE}s{$OLDSLICE}"; |
|
97 |
} else { |
|
98 |
$ASLICE="1"; |
|
99 |
$AOLDSLICE="2"; |
|
100 |
$ATOFLASH="{$BOOT_DRIVE}s{$SLICE}"; |
|
101 |
$ACOMPLETE_PATH="{$BOOT_DRIVE}s{$SLICE}a"; |
|
102 |
$AGLABEL_SLICE="pfsense0"; |
|
103 |
$AUFS_ID="0"; |
|
104 |
$AOLD_UFS_ID="1"; |
|
105 |
$ABOOTFLASH="{$BOOT_DRIVE}s{$OLDSLICE}"; |
|
106 |
} |
|
107 |
exec("gpart set -a active -i {$ASLICE} {$ABOOT_DRIVE}"); |
|
108 |
exec("/usr/sbin/boot0cfg -s {$ASLICE} -v /dev/{$ABOOT_DRIVE}"); |
|
109 |
exec("/bin/mkdir /tmp/{$AGLABEL_SLICE}"); |
|
110 |
exec("/sbin/fsck_ufs -y /dev/{$ACOMPLETE_PATH}"); |
|
111 |
exec("/sbin/mount /dev/ufs/{$AGLABEL_SLICE} /tmp/{$AGLABEL_SLICE}"); |
|
112 |
exec("/bin/cp /etc/fstab /tmp/{$AGLABEL_SLICE}/etc/fstab"); |
|
113 |
$status = exec("sed -i \"\" \"s/pfsense{$AOLD_UFS_ID}/pfsense{$AUFS_ID}/g\" /tmp/{$AGLABEL_SLICE}/etc/fstab"); |
|
94 | 114 |
if($status) { |
95 | 115 |
file_notice("UpgradeFailure","Something went wrong when trying to update the fstab entry. Aborting upgrade."); |
96 |
exec("/sbin/umount /tmp/{$GLABEL_SLICE}"); |
|
116 |
exec("/sbin/umount /tmp/{$AGLABEL_SLICE}");
|
|
97 | 117 |
} |
98 |
exec("/sbin/umount /tmp/{$GLABEL_SLICE}"); |
|
99 |
$savemsg = "The boot slice has been set to {$BOOT_DRIVE} {$SLICE}";
|
|
118 |
exec("/sbin/umount /tmp/{$AGLABEL_SLICE}");
|
|
119 |
$savemsg = "The boot slice has been set to {$ABOOT_DRIVE} {$ASLICE}";
|
|
100 | 120 |
} |
101 | 121 |
|
102 | 122 |
if($_POST['destslice']) { |
Also available in: Unified diff
Correct set boot slice