1 |
5b237745
|
Scott Ullrich
|
#!/usr/local/bin/php -f
|
2 |
|
|
<?php
|
3 |
1b8df11b
|
Bill Marquette
|
/* $Id$ */
|
4 |
5b237745
|
Scott Ullrich
|
/*
|
5 |
|
|
rc.bootup
|
6 |
e5cd29a0
|
Scott Ullrich
|
part of pfSense by Scott Ullrich
|
7 |
|
|
originally based on m0n0wall (http://m0n0.ch/wall)
|
8 |
70045f5f
|
Scott Ullrich
|
Copyright (C) 2004-2009 Scott Ullrich <sullrich@pfsense.org>.
|
9 |
5b237745
|
Scott Ullrich
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
10 |
745188c8
|
Scott Ullrich
|
Copyright (C) 2009 Erik Kristensen
|
11 |
5b237745
|
Scott Ullrich
|
All rights reserved.
|
12 |
e5cd29a0
|
Scott Ullrich
|
|
13 |
5b237745
|
Scott Ullrich
|
Redistribution and use in source and binary forms, with or without
|
14 |
|
|
modification, are permitted provided that the following conditions are met:
|
15 |
e5cd29a0
|
Scott Ullrich
|
|
16 |
5b237745
|
Scott Ullrich
|
1. Redistributions of source code must retain the above copyright notice,
|
17 |
|
|
this list of conditions and the following disclaimer.
|
18 |
e5cd29a0
|
Scott Ullrich
|
|
19 |
5b237745
|
Scott Ullrich
|
2. Redistributions in binary form must reproduce the above copyright
|
20 |
|
|
notice, this list of conditions and the following disclaimer in the
|
21 |
|
|
documentation and/or other materials provided with the distribution.
|
22 |
e5cd29a0
|
Scott Ullrich
|
|
23 |
5b237745
|
Scott Ullrich
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
24 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
25 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
26 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
27 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
33 |
|
|
*/
|
34 |
|
|
|
35 |
6cc9e241
|
Scott Ullrich
|
function rescue_detect_keypress() {
|
36 |
|
|
// How long do you want the script to wait before moving on (in seconds)
|
37 |
1e4e8458
|
Scott Ullrich
|
$timeout=9;
|
38 |
41d07e42
|
Scott Ullrich
|
echo "\n";
|
39 |
6c616b93
|
Scott Ullrich
|
echo "[ Press R to enter recovery mode or ]\n";
|
40 |
|
|
echo "[ press I to launch the installer ]\n\n";
|
41 |
1e4e8458
|
Scott Ullrich
|
echo "(R)ecovery mode can assist by rescuing config.xml\n";
|
42 |
e5a06994
|
Scott Ullrich
|
echo "from a broken hard disk installation, etc.\n\n";
|
43 |
055abc57
|
Scott Ullrich
|
echo "(I)nstaller may be invoked now if you do \n";
|
44 |
efce1588
|
Scott Ullrich
|
echo "not wish to boot into the liveCD environment at this time.\n\n";
|
45 |
22af75a3
|
Scott Ullrich
|
echo "(C) continues the LiveCD bootup without further pause.\n\n";
|
46 |
1e4e8458
|
Scott Ullrich
|
echo "Timeout before auto boot continues (seconds): {$timeout}";
|
47 |
6cc9e241
|
Scott Ullrich
|
$key = null;
|
48 |
1e4e8458
|
Scott Ullrich
|
exec("/bin/stty erase " . chr(8));
|
49 |
055abc57
|
Scott Ullrich
|
while(!in_array($key, array("c", "C", "r","R", "i", "I", "~", "!"))) {
|
50 |
1e4e8458
|
Scott Ullrich
|
echo chr(8) . "{$timeout}";
|
51 |
e5a06994
|
Scott Ullrich
|
`/bin/stty -icanon min 0 time 25`;
|
52 |
6cc9e241
|
Scott Ullrich
|
$key = trim(`KEY=\`dd count=1 2>/dev/null\`; echo \$KEY`);
|
53 |
2eeb1781
|
Scott Ullrich
|
`/bin/stty icanon`;
|
54 |
6cc9e241
|
Scott Ullrich
|
// Decrement our timeout value
|
55 |
|
|
$timeout--;
|
56 |
|
|
// If we have reached 0 exit and continue on
|
57 |
70045f5f
|
Scott Ullrich
|
if ($timeout == 0)
|
58 |
|
|
break;
|
59 |
6cc9e241
|
Scott Ullrich
|
}
|
60 |
540bd313
|
Scott Ullrich
|
// If R or I was pressed do our logic here
|
61 |
70045f5f
|
Scott Ullrich
|
if (in_array($key, array("r", "R"))) {
|
62 |
68235416
|
Scott Ullrich
|
putenv("TERM=cons25");
|
63 |
|
|
echo "\n\nRecovery mode selected...\n";
|
64 |
f98d3d65
|
Scott Ullrich
|
passthru("/usr/bin/env TERM=cons25 /bin/tcsh -c /scripts/lua_installer_rescue");
|
65 |
d5116ed5
|
Scott Ullrich
|
} elseif (in_array($key, array("i", "I"))) {
|
66 |
68235416
|
Scott Ullrich
|
putenv("TERM=cons25");
|
67 |
|
|
echo "\n\nInstaller mode selected...\n";
|
68 |
f98d3d65
|
Scott Ullrich
|
passthru("/usr/bin/env TERM=cons25 /bin/tcsh -c /scripts/lua_installer");
|
69 |
c1da5030
|
Scott Ullrich
|
if(file_exists("/tmp/install_complete")) {
|
70 |
f98d3d65
|
Scott Ullrich
|
passthru("/etc/rc.reboot");
|
71 |
c1da5030
|
Scott Ullrich
|
exit;
|
72 |
|
|
}
|
73 |
|
|
} elseif (in_array($key, array("!", "~"))) {
|
74 |
68235416
|
Scott Ullrich
|
putenv("TERM=cons25");
|
75 |
|
|
echo "\n\nRecovery shell selected...\n";
|
76 |
6c616b93
|
Scott Ullrich
|
echo "\n";
|
77 |
c1da5030
|
Scott Ullrich
|
touch("/tmp/donotbootup");
|
78 |
|
|
exit;
|
79 |
01ef30e9
|
Scott Ullrich
|
} else {
|
80 |
|
|
echo "\n\n";
|
81 |
745188c8
|
Scott Ullrich
|
}
|
82 |
6cc9e241
|
Scott Ullrich
|
}
|
83 |
|
|
|
84 |
|
|
echo " done.\n";
|
85 |
|
|
|
86 |
|
|
echo "Initializing...";
|
87 |
|
|
echo ".";
|
88 |
|
|
require_once("/etc/inc/globals.inc");
|
89 |
483e6de8
|
Scott Ullrich
|
echo ".";
|
90 |
00a4146e
|
jim-p
|
require_once("/etc/inc/led.inc");
|
91 |
|
|
led_normalize();
|
92 |
483e6de8
|
Scott Ullrich
|
echo ".";
|
93 |
00a4146e
|
jim-p
|
if (led_count() >= 3) {
|
94 |
|
|
led_kitt();
|
95 |
|
|
}
|
96 |
483e6de8
|
Scott Ullrich
|
|
97 |
6cc9e241
|
Scott Ullrich
|
/* let the other functions know we're booting */
|
98 |
|
|
$pkg_interface = 'console';
|
99 |
410cdac4
|
Scott Ullrich
|
$g['booting'] = true;
|
100 |
6cc9e241
|
Scott Ullrich
|
|
101 |
|
|
/* parse the configuration and include all functions used below */
|
102 |
|
|
require_once("/etc/inc/config.inc");
|
103 |
|
|
echo ".";
|
104 |
032c40c7
|
Scott Ullrich
|
require_once("/etc/inc/config.console.inc");
|
105 |
|
|
echo ".";
|
106 |
3066a36f
|
Ermal Lu?i
|
require_once("/etc/inc/auth.inc");
|
107 |
|
|
echo ".";
|
108 |
6cc9e241
|
Scott Ullrich
|
require_once("/etc/inc/functions.inc");
|
109 |
62d93213
|
Scott Ullrich
|
echo ".";
|
110 |
1b1c179d
|
jim-p
|
require_once("/etc/inc/filter.inc");
|
111 |
5f2d078e
|
Scott Ullrich
|
echo ".";
|
112 |
1b1c179d
|
jim-p
|
require_once("/etc/inc/shaper.inc");
|
113 |
5f2d078e
|
Scott Ullrich
|
echo ".";
|
114 |
483e6de8
|
Scott Ullrich
|
require_once("/etc/inc/ipsec.inc");
|
115 |
|
|
echo ".";
|
116 |
|
|
require_once("/etc/inc/vpn.inc");
|
117 |
|
|
echo ".";
|
118 |
5f2d078e
|
Scott Ullrich
|
require_once("/etc/inc/openvpn.inc");
|
119 |
62d93213
|
Scott Ullrich
|
echo ".";
|
120 |
483e6de8
|
Scott Ullrich
|
require_once("/etc/inc/captiveportal.inc");
|
121 |
|
|
echo ".";
|
122 |
|
|
require_once("/etc/inc/rrd.inc");
|
123 |
|
|
echo ".";
|
124 |
3ffa8318
|
Renato Botelho
|
require_once("/etc/inc/pfsense-utils.inc");
|
125 |
|
|
echo ".";
|
126 |
62d93213
|
Scott Ullrich
|
|
127 |
6cc9e241
|
Scott Ullrich
|
/* get system memory amount */
|
128 |
|
|
$memory = get_memory();
|
129 |
|
|
$avail = $memory[0];
|
130 |
|
|
echo " done.\n";
|
131 |
|
|
|
132 |
548be1fd
|
Erik Fonnesbeck
|
conf_mount_rw(true);
|
133 |
6cc9e241
|
Scott Ullrich
|
|
134 |
7f039071
|
jim-p
|
/* save dmesg output to file */
|
135 |
|
|
system_dmesg_save();
|
136 |
|
|
|
137 |
7188fc6d
|
Scott Ullrich
|
/* check whether config reset is desired (via hardware button on WRAP/ALIX) */
|
138 |
|
|
system_check_reset_button();
|
139 |
|
|
|
140 |
6cc9e241
|
Scott Ullrich
|
/* remove previous firmware upgrade if present */
|
141 |
|
|
if (file_exists("/root/firmware.tgz"))
|
142 |
|
|
unlink("/root/firmware.tgz");
|
143 |
|
|
|
144 |
|
|
/* start devd (dhclient now uses it */
|
145 |
|
|
echo "Starting device manager (devd)...";
|
146 |
|
|
mute_kernel_msgs();
|
147 |
|
|
start_devd();
|
148 |
|
|
set_device_perms();
|
149 |
|
|
unmute_kernel_msgs();
|
150 |
|
|
echo "done.\n";
|
151 |
|
|
|
152 |
|
|
// Display rescue configuration option
|
153 |
|
|
if($g['platform'] == "cdrom")
|
154 |
|
|
rescue_detect_keypress();
|
155 |
|
|
|
156 |
d5116ed5
|
Scott Ullrich
|
echo "Loading configuration...";
|
157 |
|
|
parse_config_bootup();
|
158 |
|
|
echo "done.\n";
|
159 |
|
|
|
160 |
6cc9e241
|
Scott Ullrich
|
/*
|
161 |
|
|
* Determine if we need to throw a interface exception
|
162 |
|
|
* and ask the user to reassign interfaces. This will
|
163 |
|
|
* avoid a reboot and thats a good thing.
|
164 |
|
|
*/
|
165 |
|
|
while(is_interface_mismatch() == true) {
|
166 |
a6bd4155
|
jim-p
|
led_assigninterfaces();
|
167 |
6cc9e241
|
Scott Ullrich
|
echo "\nNetwork interface mismatch -- Running interface assignment option.\n";
|
168 |
7f8d463f
|
Ermal
|
$ifaces = get_interface_list();
|
169 |
|
|
if (is_array($ifaces)) {
|
170 |
|
|
foreach($ifaces as $iface => $ifdata)
|
171 |
|
|
interfaces_bring_up($iface);
|
172 |
|
|
}
|
173 |
6cc9e241
|
Scott Ullrich
|
set_networking_interfaces_ports();
|
174 |
a6bd4155
|
jim-p
|
led_kitt();
|
175 |
6cc9e241
|
Scott Ullrich
|
}
|
176 |
|
|
|
177 |
|
|
/* convert config and clean backups */
|
178 |
|
|
echo "Updating configuration...";
|
179 |
|
|
convert_config();
|
180 |
|
|
echo "done.\n";
|
181 |
|
|
|
182 |
|
|
echo "Cleaning backup cache...";
|
183 |
|
|
cleanup_backupcache(true);
|
184 |
|
|
echo "done.\n";
|
185 |
|
|
|
186 |
|
|
/* read in /etc/sysctl.conf and set values if needed */
|
187 |
|
|
echo "Setting up extended sysctls...";
|
188 |
|
|
system_setup_sysctl();
|
189 |
|
|
echo "done.\n";
|
190 |
|
|
|
191 |
09f18f59
|
jim-p
|
/* enable glxsb if wanted */
|
192 |
|
|
load_glxsb();
|
193 |
|
|
|
194 |
6cc9e241
|
Scott Ullrich
|
/* run any early shell commands specified in config.xml */
|
195 |
|
|
system_do_shell_commands(1);
|
196 |
ef0090a3
|
Scott Ullrich
|
|
197 |
6cc9e241
|
Scott Ullrich
|
/* set up our timezone */
|
198 |
|
|
system_timezone_configure();
|
199 |
|
|
|
200 |
|
|
/* set up our hostname */
|
201 |
|
|
system_hostname_configure();
|
202 |
|
|
|
203 |
|
|
/* make hosts file */
|
204 |
|
|
system_hosts_generate();
|
205 |
|
|
|
206 |
|
|
/* configure loopback interface */
|
207 |
|
|
interfaces_loopback_configure();
|
208 |
|
|
|
209 |
b29d9c8e
|
Ermal
|
echo "Starting Secure Shell Services...";
|
210 |
|
|
mwexec_bg("/etc/sshd");
|
211 |
|
|
echo "done.\n";
|
212 |
|
|
|
213 |
9a4c3eed
|
Ermal
|
/* setup polling */
|
214 |
|
|
echo "Setting up polling defaults...";
|
215 |
|
|
setup_polling();
|
216 |
|
|
echo "done.\n";
|
217 |
|
|
|
218 |
|
|
/* setup interface microcode which improves tcp/ip speed */
|
219 |
7d6128e0
|
Ermal
|
echo "Setting up interfaces microcode...";
|
220 |
9a4c3eed
|
Ermal
|
setup_microcode();
|
221 |
|
|
echo "done.\n";
|
222 |
|
|
|
223 |
6cc9e241
|
Scott Ullrich
|
/* set up interfaces */
|
224 |
|
|
if(!$debugging)
|
225 |
70b89814
|
Scott Ullrich
|
mute_kernel_msgs();
|
226 |
6cc9e241
|
Scott Ullrich
|
interfaces_configure();
|
227 |
|
|
if(!$debugging)
|
228 |
70b89814
|
Scott Ullrich
|
unmute_kernel_msgs();
|
229 |
86ddbb71
|
Scott Ullrich
|
|
230 |
4994b350
|
smos
|
/* re-make hosts file after configuring interfaces */
|
231 |
|
|
system_hosts_generate();
|
232 |
|
|
|
233 |
d09d53ac
|
Ermal
|
/* start OpenVPN server & clients */
|
234 |
|
|
echo "Syncing OpenVPN settings...";
|
235 |
|
|
openvpn_resync_all();
|
236 |
|
|
echo "done.\n";
|
237 |
|
|
|
238 |
6cc9e241
|
Scott Ullrich
|
/* generate resolv.conf */
|
239 |
|
|
system_resolvconf_generate();
|
240 |
aa01f2f2
|
Scott Ullrich
|
|
241 |
93291959
|
sullrich
|
/* start syslogd */
|
242 |
|
|
system_syslogd_start();
|
243 |
|
|
|
244 |
2fd9d050
|
Scott Ullrich
|
/* setup altq + pf */
|
245 |
|
|
filter_configure_sync();
|
246 |
|
|
|
247 |
6cc9e241
|
Scott Ullrich
|
/* start pflog */
|
248 |
|
|
echo "Starting PFLOG...";
|
249 |
|
|
filter_pflog_start();
|
250 |
|
|
echo "done.\n";
|
251 |
d0e94aaf
|
Scott Ullrich
|
|
252 |
17fdcb8d
|
Ermal Lu?i
|
/* reconfigure our gateway monitor */
|
253 |
6cc9e241
|
Scott Ullrich
|
echo "Setting up gateway monitors...";
|
254 |
17fdcb8d
|
Ermal Lu?i
|
setup_gateways_monitor();
|
255 |
|
|
echo "done.\n";
|
256 |
|
|
|
257 |
|
|
echo "Synchronizing user settings...";
|
258 |
24e61cce
|
Ermal
|
local_sync_accounts();
|
259 |
6cc9e241
|
Scott Ullrich
|
echo "done.\n";
|
260 |
d0e94aaf
|
Scott Ullrich
|
|
261 |
6cc9e241
|
Scott Ullrich
|
if($avail > 0 and $avail < 65) {
|
262 |
|
|
echo "System has less than 65 megabytes of ram {$avail}. Delaying webConfigurator startup.\n";
|
263 |
|
|
/* start webConfigurator up on final pass */
|
264 |
f3239b2d
|
Chris Buechler
|
mwexec("/usr/local/sbin/pfSctl -c 'service restart webgui'");
|
265 |
6cc9e241
|
Scott Ullrich
|
} else {
|
266 |
|
|
/* start web server */
|
267 |
|
|
system_webgui_start();
|
268 |
|
|
}
|
269 |
ef9366bd
|
Scott Ullrich
|
|
270 |
6cc9e241
|
Scott Ullrich
|
/* configure cron service */
|
271 |
|
|
echo "Configuring CRON...";
|
272 |
|
|
configure_cron();
|
273 |
|
|
echo "done.\n";
|
274 |
68cd47b3
|
Scott Ullrich
|
|
275 |
6cc9e241
|
Scott Ullrich
|
/* set up static routes */
|
276 |
|
|
system_routing_configure();
|
277 |
d0e94aaf
|
Scott Ullrich
|
|
278 |
6cc9e241
|
Scott Ullrich
|
/* enable routing */
|
279 |
|
|
system_routing_enable();
|
280 |
e5cd29a0
|
Scott Ullrich
|
|
281 |
d1265444
|
Ermal
|
/* start load balancer daemon */
|
282 |
|
|
relayd_configure();
|
283 |
|
|
|
284 |
6cc9e241
|
Scott Ullrich
|
/* configure console menu */
|
285 |
|
|
system_console_configure();
|
286 |
a005424e
|
Scott Ullrich
|
|
287 |
6cc9e241
|
Scott Ullrich
|
/* start the NTP client */
|
288 |
|
|
echo "Starting OpenNTP time client...";
|
289 |
|
|
system_ntp_configure();
|
290 |
|
|
echo "done.\n";
|
291 |
5ffb18e0
|
Scott Ullrich
|
|
292 |
6cc9e241
|
Scott Ullrich
|
/* Launch on bootup and keep trying to sync. Exit once time/date has been sync'd. */
|
293 |
|
|
mwexec_bg("/usr/local/sbin/ntpdate_sync_once.sh");
|
294 |
5b237745
|
Scott Ullrich
|
|
295 |
24d619f5
|
Ermal
|
/* start DHCP service */
|
296 |
|
|
services_dhcpd_configure();
|
297 |
|
|
|
298 |
6cc9e241
|
Scott Ullrich
|
/* start dnsmasq service */
|
299 |
|
|
services_dnsmasq_configure();
|
300 |
e5cd29a0
|
Scott Ullrich
|
|
301 |
92150bd8
|
Ermal
|
/* start dhcpleases dhpcp hosts leases program */
|
302 |
|
|
system_dhcpleases_configure();
|
303 |
|
|
|
304 |
6cc9e241
|
Scott Ullrich
|
/* start DHCP relay */
|
305 |
|
|
services_dhcrelay_configure();
|
306 |
562fca6d
|
Scott Ullrich
|
|
307 |
422bc2a7
|
Ermal
|
/* dyndns service updates */
|
308 |
|
|
send_event("service reload dyndnsall");
|
309 |
|
|
|
310 |
8c41a3e4
|
Ermal
|
/* Run a filter configure now that most all services have started */
|
311 |
|
|
filter_configure_sync();
|
312 |
|
|
|
313 |
6cc9e241
|
Scott Ullrich
|
/* setup pppoe and pptp */
|
314 |
|
|
vpn_setup();
|
315 |
c6e604d8
|
Scott Ullrich
|
|
316 |
6cc9e241
|
Scott Ullrich
|
/* start the captive portal */
|
317 |
|
|
captiveportal_configure();
|
318 |
f4959a69
|
Scott Ullrich
|
|
319 |
336e3c1c
|
Charlie
|
/* start Voucher support */
|
320 |
|
|
voucher_configure();
|
321 |
|
|
|
322 |
6cc9e241
|
Scott Ullrich
|
/* run any shell commands specified in config.xml */
|
323 |
|
|
system_do_shell_commands();
|
324 |
9f966bc9
|
Scott Ullrich
|
|
325 |
6cc9e241
|
Scott Ullrich
|
/* start IPsec tunnels */
|
326 |
|
|
vpn_ipsec_configure();
|
327 |
a2a13c97
|
smos
|
/* Reload dynamic hostname tunnels after bootup finishes */
|
328 |
|
|
mwexec_bg("/etc/rc.newipsecdns");
|
329 |
a199b93e
|
Scott Ullrich
|
|
330 |
6cc9e241
|
Scott Ullrich
|
/* start SNMP service */
|
331 |
|
|
services_snmpd_configure();
|
332 |
11cbd478
|
Scott Ullrich
|
|
333 |
6cc9e241
|
Scott Ullrich
|
/* power down hard drive if needed/set */
|
334 |
|
|
system_set_harddisk_standby();
|
335 |
011bff69
|
Bill Marquette
|
|
336 |
6cc9e241
|
Scott Ullrich
|
/* lock down console if necessary */
|
337 |
a46e450c
|
Ermal Lu?i
|
auto_login();
|
338 |
d0e94aaf
|
Scott Ullrich
|
|
339 |
6cc9e241
|
Scott Ullrich
|
/* load graphing functions */
|
340 |
|
|
enable_rrd_graphing();
|
341 |
|
|
|
342 |
|
|
/* startup OLSR if needed */
|
343 |
|
|
setup_wireless_olsr();
|
344 |
|
|
|
345 |
|
|
/* startup routed if needed */
|
346 |
4395500c
|
Warren Baker
|
include_once("/usr/local/pkg/routed.inc");
|
347 |
6cc9e241
|
Scott Ullrich
|
setup_routed();
|
348 |
|
|
|
349 |
|
|
/* enable watchdog if supported */
|
350 |
|
|
enable_watchdog();
|
351 |
|
|
|
352 |
|
|
/* if <system><afterbootupshellcmd> exists, execute the command */
|
353 |
|
|
if($config['system']['afterbootupshellcmd'] <> "") {
|
354 |
|
|
echo "Running afterbootupshellcmd {$config['system']['afterbootupshellcmd']}\n";
|
355 |
|
|
mwexec($config['system']['afterbootupshellcmd']);
|
356 |
|
|
}
|
357 |
|
|
|
358 |
9f274393
|
Chris Buechler
|
if($avail < $g['minimum_ram_warning']) {
|
359 |
6cc9e241
|
Scott Ullrich
|
require_once("/etc/inc/notices.inc");
|
360 |
9f274393
|
Chris Buechler
|
file_notice("{$g['product_name']}MemoryRequirements", "{$g['product_name']} requires at least {$g['minimum_ram_warning_text']} of RAM. Expect unusual performance. This platform is not supported.", "Memory", "", 1);
|
361 |
c5901d28
|
Ermal
|
mwexec("/sbin/sysctl net.inet.tcp.recvspace=4096");
|
362 |
|
|
mwexec("/sbin/sysctl net.inet.tcp.sendspace=4096");
|
363 |
6cc9e241
|
Scott Ullrich
|
}
|
364 |
|
|
|
365 |
|
|
/* if we are operating at 1000 then increase timeouts.
|
366 |
|
|
this was never accounted for after moving to 1000 hz */
|
367 |
c5901d28
|
Ermal
|
$kern_hz = `/sbin/sysctl kern.clockrate | /usr/bin/awk '{ print $5 }' | /usr/bin/cut -d"," -f1`;
|
368 |
6cc9e241
|
Scott Ullrich
|
$kern_hz = trim($kern_hz, "\r\n");
|
369 |
|
|
if($kern_hz == "1000")
|
370 |
c5901d28
|
Ermal
|
mwexec("/sbin/sysctl net.inet.tcp.rexmit_min=30");
|
371 |
c108ec01
|
Scott Ullrich
|
|
372 |
34c7f02e
|
Scott Ullrich
|
/* start the igmpproxy daemon */
|
373 |
6cc9e241
|
Scott Ullrich
|
services_igmpproxy_configure();
|
374 |
41997fbb
|
Ermal Luci
|
|
375 |
6cc9e241
|
Scott Ullrich
|
/* start the upnp daemon if it is enabled */
|
376 |
|
|
upnp_start();
|
377 |
6f20377b
|
Scott Ullrich
|
|
378 |
6cc9e241
|
Scott Ullrich
|
/* If powerd is enabled, lets launch it */
|
379 |
|
|
activate_powerd();
|
380 |
8e9fa41d
|
Scott Ullrich
|
|
381 |
bf072179
|
jim-p
|
/* Remove the old shutdown binary if we kept it. */
|
382 |
|
|
if (file_exists("/sbin/shutdown.old"))
|
383 |
c5901d28
|
Ermal
|
@unlink("/sbin/shutdown.old");
|
384 |
bf072179
|
jim-p
|
|
385 |
9b193619
|
Scott Ullrich
|
/* Resync / Reinstall packages if need be */
|
386 |
|
|
if(file_exists('/conf/needs_package_sync')) {
|
387 |
|
|
if($config['installedpackages'] <> '' && is_array($config['installedpackages']['package'])) {
|
388 |
7aa9ab00
|
Scott Ullrich
|
require_once("pkg-utils.inc");
|
389 |
9b193619
|
Scott Ullrich
|
if($g['platform'] == "pfSense" || $g['platform'] == "nanobsd") {
|
390 |
261c7de8
|
jim-p
|
mark_subsystem_dirty('packagelock');
|
391 |
9b193619
|
Scott Ullrich
|
pkg_reinstall_all();
|
392 |
261c7de8
|
jim-p
|
clear_subsystem_dirty('packagelock');
|
393 |
9b193619
|
Scott Ullrich
|
}
|
394 |
|
|
}
|
395 |
393cd3fc
|
Ermal
|
@unlink('/conf/needs_package_sync');
|
396 |
9b193619
|
Scott Ullrich
|
}
|
397 |
|
|
|
398 |
6cc9e241
|
Scott Ullrich
|
/* done */
|
399 |
27556fa9
|
Scott Ullrich
|
unset($g['booting']);
|
400 |
5c60c947
|
Scott Ullrich
|
|
401 |
00a4146e
|
jim-p
|
led_normalize();
|
402 |
410cdac4
|
Scott Ullrich
|
|
403 |
548be1fd
|
Erik Fonnesbeck
|
conf_mount_ro(true);
|
404 |
6346595c
|
Ermal Lu?i
|
|
405 |
24e61cce
|
Ermal
|
?>
|