summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2016-11-11 15:22:29 -0500
committerjim-p <jimp@pfsense.org>2016-11-11 15:22:29 -0500
commit92a78939583e2be7f7cc52d045bc48a2e2264d1d (patch)
tree48b15bf40c5da9a1deedbd6939e803178764662e
parent464a540a3b7f7c5351526dbc515ade4554b1976e (diff)
downloadpfsense-92a78939583e2be7f7cc52d045bc48a2e2264d1d.zip
pfsense-92a78939583e2be7f7cc52d045bc48a2e2264d1d.tar.gz
Add options to console menu reboot selection to reboot into single user mode and to reboot and force a filesystem check. Implements #6639
-rwxr-xr-xsrc/etc/pfSense-rc14
-rwxr-xr-xsrc/etc/rc.initial.reboot28
2 files changed, 34 insertions, 8 deletions
diff --git a/src/etc/pfSense-rc b/src/etc/pfSense-rc
index caa0316..783b5a6 100755
--- a/src/etc/pfSense-rc
+++ b/src/etc/pfSense-rc
@@ -60,9 +60,17 @@ if [ ! -z "`sysctl -Nq debug.ddb.scripting.scripts`" ]; then
/sbin/ddb /etc/ddb.conf
fi
-if [ -e /root/force_fsck ]; then
- echo "Forcing filesystem(s) check..."
- /sbin/fsck -y -F -t ufs
+fsck_forced_iterations=`/bin/kenv pfsense.fsck.force`
+if [ ! -z "${fsck_forced_iterations}" ]; then
+ echo "Forcing filesystem check (${fsck_forced_iterations} times)..."
+ while [ ${fsck_forced_iterations} -gt 0 ]; do
+ /sbin/fsck -y -F -t ufs
+ fsck_forced_iterations=$((fsck_forced_iterations - 1))
+ done
+fi
+
+if [ -e /root/force_growfs ]; then
+ /etc/rc.d/growfs onestart
fi
FSCK_ACTION_NEEDED=0
diff --git a/src/etc/rc.initial.reboot b/src/etc/rc.initial.reboot
index 30c1b72..0380f7c 100755
--- a/src/etc/rc.initial.reboot
+++ b/src/etc/rc.initial.reboot
@@ -33,13 +33,31 @@ require_once("captiveportal.inc");
$fp = fopen('php://stdin', 'r');
echo "\n" . sprintf(gettext("%s will reboot. This may take a few minutes, depending on your hardware."), $g['product_name']) . "\n";
-echo gettext("Do you want to proceed [y|n]?") . " ";
+echo gettext("Do you want to proceed?") . "\n\n";
+echo " " . gettext("Y/y: Reboot normally") . "\n";
+echo " " . gettext("S: Reboot into Single User Mode (requires console access!)") . "\n";
+echo " " . gettext("F: Reboot and run a filesystem check") . "\n\n";
-if (strcasecmp(chop(fgets($fp)), "y") == 0) {
- echo "\n" . sprintf(gettext("%s is rebooting now."), $g['product_name']) . "\n";
- system_reboot_sync();
+echo gettext("Enter an option:") . " ";
+
+switch (chop(fgets($fp))) {
+ case "S":
+ mwexec('/sbin/nextboot -o "-s" -k kernel');
+ echo "\n" . sprintf(gettext("%s is rebooting into single user mode now."), $g['product_name']) . "\n";
+ system_reboot_sync();
+ break;
+ case "F":
+ mwexec('/sbin/nextboot -e "pfsense.fsck.force=5"');
+ echo "\n" . sprintf(gettext("%s is rebooting for a filesystem check now."), $g['product_name']) . "\n";
+ system_reboot_sync();
+ break;
+ case "Y":
+ case "y":
+ echo "\n" . sprintf(gettext("%s is rebooting now."), $g['product_name']) . "\n";
+ system_reboot_sync();
+ break;
}
fclose($fp);
-
+echo "\n";
?>
OpenPOWER on IntegriCloud