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