Project

General

Profile

Feature #6639 » nextboot-menu-options-2.4.diff

Jim Pingle, 07/25/2016 01:34 PM

View differences:

src/etc/pfSense-rc
65 65
	/sbin/ddb /etc/ddb.conf
66 66
fi
67 67

  
68
if [ -e /root/force_fsck ]; then
69
	echo "Forcing filesystem(s) check..."
70
	/sbin/fsck -y -F -t ufs
68
fsck_forced_iterations=`/bin/kenv pfsense.fsck.force`
69
if [ ! -z "${fsck_forced_iterations}" ]; then
70
	echo "Forcing filesystem(s) check (${fsck_forced_iterations} times)..."
71
	while [ ${fsck_forced_iterations} -gt 0 ]; do
72
		/sbin/fsck -y -F -t ufs
73
		fsck_forced_iterations=$((fsck_forced_iterations - 1))
74
	done
71 75
fi
72 76

  
73 77
if [ "${PLATFORM}" != "cdrom" ]; then
src/etc/rc.initial.reboot
33 33
$fp = fopen('php://stdin', 'r');
34 34

  
35 35
echo "\n" . sprintf(gettext("%s will reboot. This may take a few minutes, depending on your hardware."), $g['product_name']) . "\n";
36
echo gettext("Do you want to proceed [y|n]?") . " ";
36
echo gettext("Do you want to proceed?") . "\n\n";
37
echo "    " . gettext("Y: Reboot normally") . "\n";
38
echo "    " . gettext("S: Reboot into Single User Mode (requires console access!)") . "\n";
39
echo "    " . gettext("F: Reboot and run a filesystem check") . "\n\n";
37 40

  
38
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
39
	echo "\n" . sprintf(gettext("%s is rebooting now."), $g['product_name']) . "\n";
40
	system_reboot_sync();
41
echo gettext("Enter an option:") . " ";
42

  
43
switch (strtolower(chop(fgets($fp)))) {
44
	case "s":
45
		mwexec('/sbin/nextboot -o "-s" -k kernel');
46
		echo "\n" . sprintf(gettext("%s is rebooting into single user mode now."), $g['product_name']) . "\n";
47
		system_reboot_sync();
48
		break;
49
	case "f":
50
		mwexec('/sbin/nextboot -e "pfsense.fsck.force=5"');
51
		echo "\n" . sprintf(gettext("%s is rebooting for a filesystem check now."), $g['product_name']) . "\n";
52
		system_reboot_sync();
53
		break;
54
	case "y":
55
		echo "\n" . sprintf(gettext("%s is rebooting now."), $g['product_name']) . "\n";
56
		system_reboot_sync();
57
		break;
41 58
}
42 59

  
43 60
fclose($fp);
44

  
61
echo "\n";
45 62
?>
(1-1/2)