1
|
#!/usr/local/bin/php-cgi -f
|
2
|
<?php
|
3
|
/*
|
4
|
* rc.initial.halt
|
5
|
*
|
6
|
* part of pfSense (https://www.pfsense.org)
|
7
|
* Copyright (c) 2004 Bachman Kharazmi
|
8
|
* Copyright (c) 2004-2018 Rubicon Communications, LLC (Netgate)
|
9
|
* All rights reserved.
|
10
|
*
|
11
|
* originally part of m0n0wall (http://m0n0.ch/wall)
|
12
|
* Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
13
|
* All rights reserved.
|
14
|
*
|
15
|
* Redistribution and use in source and binary forms, with or without
|
16
|
* modification, are permitted provided that the following conditions are met:
|
17
|
*
|
18
|
* 1. Redistributions of source code must retain the above copyright notice,
|
19
|
* this list of conditions and the following disclaimer.
|
20
|
*
|
21
|
* 2. Redistributions in binary form must reproduce the above copyright
|
22
|
* notice, this list of conditions and the following disclaimer in
|
23
|
* the documentation and/or other materials provided with the
|
24
|
* distribution.
|
25
|
*
|
26
|
* 3. All advertising materials mentioning features or use of this software
|
27
|
* must display the following acknowledgment:
|
28
|
* "This product includes software developed by the pfSense Project
|
29
|
* for use in the pfSense® software distribution. (http://www.pfsense.org/).
|
30
|
*
|
31
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
32
|
* endorse or promote products derived from this software without
|
33
|
* prior written permission. For written permission, please contact
|
34
|
* coreteam@pfsense.org.
|
35
|
*
|
36
|
* 5. Products derived from this software may not be called "pfSense"
|
37
|
* nor may "pfSense" appear in their names without prior written
|
38
|
* permission of the Electric Sheep Fencing, LLC.
|
39
|
*
|
40
|
* 6. Redistributions of any form whatsoever must retain the following
|
41
|
* acknowledgment:
|
42
|
*
|
43
|
* "This product includes software developed by the pfSense Project
|
44
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
45
|
*
|
46
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
47
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
48
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
49
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
50
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
51
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
52
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
53
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
54
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
55
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
56
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
57
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
58
|
*/
|
59
|
|
60
|
/* parse the configuration and include all functions used below */
|
61
|
require_once("config.inc");
|
62
|
require_once("functions.inc");
|
63
|
|
64
|
$fp = fopen('php://stdin', 'r');
|
65
|
|
66
|
echo "\n" . sprintf(gettext("%s will shutdown and halt system. This may take a few minutes, depending on your hardware."), $g['product_name']) . "\n";
|
67
|
echo gettext("Do you want to proceed [y|n]?") . " ";
|
68
|
|
69
|
if (strcasecmp(chop(fgets($fp)), "y") == 0) {
|
70
|
echo "\n" . sprintf(gettext("%s will shutdown and halt system now."), $g['product_name']) . "\n";
|
71
|
system_halt();
|
72
|
}
|
73
|
|
74
|
fclose($fp);
|
75
|
|
76
|
?>
|