1 |
cb7d18d5
|
Renato Botelho
|
#!/usr/local/bin/php-cgi -f
|
2 |
5b237745
|
Scott Ullrich
|
<?php
|
3 |
|
|
/*
|
4 |
ac24dc24
|
Renato Botelho
|
* rc.initial.reboot
|
5 |
|
|
*
|
6 |
|
|
* part of pfSense (https://www.pfsense.org)
|
7 |
81299b5c
|
Renato Botelho
|
* Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
|
8 |
ac24dc24
|
Renato Botelho
|
* All rights reserved.
|
9 |
|
|
*
|
10 |
|
|
* originally part of m0n0wall (http://m0n0.ch/wall)
|
11 |
c5d81585
|
Renato Botelho
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
12 |
ac24dc24
|
Renato Botelho
|
* All rights reserved.
|
13 |
|
|
*
|
14 |
b12ea3fb
|
Renato Botelho
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
15 |
|
|
* you may not use this file except in compliance with the License.
|
16 |
|
|
* You may obtain a copy of the License at
|
17 |
ac24dc24
|
Renato Botelho
|
*
|
18 |
b12ea3fb
|
Renato Botelho
|
* http://www.apache.org/licenses/LICENSE-2.0
|
19 |
ac24dc24
|
Renato Botelho
|
*
|
20 |
b12ea3fb
|
Renato Botelho
|
* Unless required by applicable law or agreed to in writing, software
|
21 |
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
22 |
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
23 |
|
|
* See the License for the specific language governing permissions and
|
24 |
|
|
* limitations under the License.
|
25 |
ac24dc24
|
Renato Botelho
|
*/
|
26 |
e3c4b6b7
|
Scott Ullrich
|
|
27 |
ac24dc24
|
Renato Botelho
|
/* parse the configuration and include all functions used below */
|
28 |
|
|
require_once("config.inc");
|
29 |
|
|
require_once("functions.inc");
|
30 |
|
|
require_once("filter.inc");
|
31 |
|
|
require_once("captiveportal.inc");
|
32 |
e3c4b6b7
|
Scott Ullrich
|
|
33 |
ac24dc24
|
Renato Botelho
|
$fp = fopen('php://stdin', 'r');
|
34 |
e3c4b6b7
|
Scott Ullrich
|
|
35 |
ac24dc24
|
Renato Botelho
|
echo "\n" . sprintf(gettext("%s will reboot. This may take a few minutes, depending on your hardware."), $g['product_name']) . "\n";
|
36 |
92a78939
|
jim-p
|
echo gettext("Do you want to proceed?") . "\n\n";
|
37 |
|
|
echo " " . gettext("Y/y: Reboot normally") . "\n";
|
38 |
ce3a92c0
|
jim-p
|
if (!is_module_loaded("zfs.ko")) {
|
39 |
|
|
echo " " . gettext("R/r: Reroot (Stop processes, remount disks, re-run startup sequence)") . "\n";
|
40 |
|
|
}
|
41 |
92a78939
|
jim-p
|
echo " " . gettext("S: Reboot into Single User Mode (requires console access!)") . "\n";
|
42 |
|
|
echo " " . gettext("F: Reboot and run a filesystem check") . "\n\n";
|
43 |
e3c4b6b7
|
Scott Ullrich
|
|
44 |
92a78939
|
jim-p
|
echo gettext("Enter an option:") . " ";
|
45 |
|
|
|
46 |
|
|
switch (chop(fgets($fp))) {
|
47 |
|
|
case "S":
|
48 |
|
|
mwexec('/sbin/nextboot -o "-s" -k kernel');
|
49 |
|
|
echo "\n" . sprintf(gettext("%s is rebooting into single user mode now."), $g['product_name']) . "\n";
|
50 |
|
|
system_reboot_sync();
|
51 |
|
|
break;
|
52 |
|
|
case "F":
|
53 |
|
|
mwexec('/sbin/nextboot -e "pfsense.fsck.force=5"');
|
54 |
|
|
echo "\n" . sprintf(gettext("%s is rebooting for a filesystem check now."), $g['product_name']) . "\n";
|
55 |
|
|
system_reboot_sync();
|
56 |
|
|
break;
|
57 |
a2c453fd
|
jim-p
|
case "R":
|
58 |
|
|
case "r":
|
59 |
ce3a92c0
|
jim-p
|
if (!is_module_loaded("zfs.ko")) {
|
60 |
|
|
echo "\n" . sprintf(gettext("%s is rerooting now."), $g['product_name']) . "\n";
|
61 |
|
|
system_reboot_sync(true);
|
62 |
|
|
}
|
63 |
a2c453fd
|
jim-p
|
break;
|
64 |
92a78939
|
jim-p
|
case "Y":
|
65 |
|
|
case "y":
|
66 |
|
|
echo "\n" . sprintf(gettext("%s is rebooting now."), $g['product_name']) . "\n";
|
67 |
|
|
system_reboot_sync();
|
68 |
|
|
break;
|
69 |
a2c453fd
|
jim-p
|
default:
|
70 |
|
|
break;
|
71 |
ac24dc24
|
Renato Botelho
|
}
|
72 |
e3c4b6b7
|
Scott Ullrich
|
|
73 |
ac24dc24
|
Renato Botelho
|
fclose($fp);
|
74 |
92a78939
|
jim-p
|
echo "\n";
|
75 |
55c61326
|
Ermal Lu?i
|
?>
|