1 |
5b237745
|
Scott Ullrich
|
#!/usr/local/bin/php -f
|
2 |
|
|
<?php
|
3 |
1b8df11b
|
Bill Marquette
|
/* $Id$ */
|
4 |
5b237745
|
Scott Ullrich
|
/*
|
5 |
|
|
rc.initial.reboot
|
6 |
|
|
part of m0n0wall (http://m0n0.ch/wall)
|
7 |
e3c4b6b7
|
Scott Ullrich
|
|
8 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
9 |
|
|
All rights reserved.
|
10 |
e3c4b6b7
|
Scott Ullrich
|
|
11 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
12 |
|
|
modification, are permitted provided that the following conditions are met:
|
13 |
e3c4b6b7
|
Scott Ullrich
|
|
14 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
15 |
|
|
this list of conditions and the following disclaimer.
|
16 |
e3c4b6b7
|
Scott Ullrich
|
|
17 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
18 |
|
|
notice, this list of conditions and the following disclaimer in the
|
19 |
|
|
documentation and/or other materials provided with the distribution.
|
20 |
e3c4b6b7
|
Scott Ullrich
|
|
21 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
22 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
23 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
24 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
25 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
27 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
28 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
29 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
30 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
31 |
|
|
*/
|
32 |
|
|
|
33 |
|
|
/* parse the configuration and include all functions used below */
|
34 |
|
|
require_once("config.inc");
|
35 |
|
|
require_once("functions.inc");
|
36 |
e3c4b6b7
|
Scott Ullrich
|
|
37 |
5b237745
|
Scott Ullrich
|
$fp = fopen('php://stdin', 'r');
|
38 |
e3c4b6b7
|
Scott Ullrich
|
|
39 |
5b237745
|
Scott Ullrich
|
echo <<<EOD
|
40 |
|
|
|
41 |
bfaca655
|
Scott Ullrich
|
{$g['product_name']} will reboot. This may take one minute.
|
42 |
e3c4b6b7
|
Scott Ullrich
|
|
43 |
bbc3533f
|
Scott Ullrich
|
Do you want to proceed [y|n]?
|
44 |
5b237745
|
Scott Ullrich
|
EOD;
|
45 |
|
|
|
46 |
|
|
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
|
47 |
e3c4b6b7
|
Scott Ullrich
|
|
48 |
5b237745
|
Scott Ullrich
|
echo <<<EOD
|
49 |
|
|
|
50 |
bfaca655
|
Scott Ullrich
|
{$g['product_name']} is rebooting now.
|
51 |
5b237745
|
Scott Ullrich
|
|
52 |
|
|
EOD;
|
53 |
e3c4b6b7
|
Scott Ullrich
|
|
54 |
5b237745
|
Scott Ullrich
|
system_reboot_sync();
|
55 |
|
|
}
|
56 |
5397d0eb
|
Scott Ullrich
|
|
57 |
|
|
fclose($fp);
|
58 |
|
|
|
59 |
5b237745
|
Scott Ullrich
|
?>
|