1
|
#!/bin/sh
|
2
|
|
3
|
/usr/local/bin/php -q <<ENDPHP
|
4
|
<?php
|
5
|
/* $Id$ */
|
6
|
/*
|
7
|
rc.stop_packages
|
8
|
part of pfSense (http://www.pfSense.com)
|
9
|
Copyright (C) 2004 Scott Ullrich
|
10
|
All rights reserved.
|
11
|
|
12
|
Redistribution and use in source and binary forms, with or without
|
13
|
modification, are permitted provided that the following conditions are met:
|
14
|
|
15
|
1. Redistributions of source code must retain the above copyright notice,
|
16
|
this list of conditions and the following disclaimer.
|
17
|
|
18
|
2. Redistributions in binary form must reproduce the above copyright
|
19
|
notice, this list of conditions and the following disclaimer in the
|
20
|
documentation and/or other materials provided with the distribution.
|
21
|
|
22
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
23
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
24
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
25
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
26
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
27
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
28
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
29
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
30
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
31
|
POSSIBILITY OF SUCH DAMAGE.
|
32
|
*/
|
33
|
|
34
|
require_once("config.inc");
|
35
|
require_once("functions.inc");
|
36
|
require_once("filter.inc");
|
37
|
require_once("shaper.inc");
|
38
|
require_once("captiveportal.inc");
|
39
|
require_once("pkg-utils.inc");
|
40
|
require_once("pfsense-utils.inc");
|
41
|
require_once("service-utils.inc");
|
42
|
|
43
|
log_error("Stopping all packages.");
|
44
|
|
45
|
$rcfiles = glob("{$rcfileprefix}*.sh");
|
46
|
if (!$rcfiles)
|
47
|
$rcfiles = array();
|
48
|
else {
|
49
|
$rcfiles = array_flip($rcfiles);
|
50
|
if (!$rcfiles)
|
51
|
$rcfiles = array();
|
52
|
}
|
53
|
|
54
|
if (is_array($config['installedpackages']['package'])) {
|
55
|
foreach($config['installedpackages']['package'] as $package) {
|
56
|
echo " Stopping package {$package['name']}...";
|
57
|
stop_service($package['name']);
|
58
|
unset($rcfiles["{$rcfileprefix}{$package['name']}.sh"]);
|
59
|
echo "done.\n";
|
60
|
}
|
61
|
}
|
62
|
|
63
|
$shell = @popen("/bin/sh", "w");
|
64
|
if ($shell) {
|
65
|
foreach ($rcfiles as $rcfile => $number) {
|
66
|
echo " Stopping {$rcfile}...";
|
67
|
fwrite($shell, "{$rcfile} stop >>/tmp/bootup_messages 2>&1");
|
68
|
echo "done.\n";
|
69
|
}
|
70
|
|
71
|
pclose($shell);
|
72
|
}
|
73
|
?>
|
74
|
ENDPHP
|