summaryrefslogtreecommitdiffstats
path: root/etc/rc.bootup
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-02-25 01:08:35 +0545
committerPhil Davis <phil.davis@inf.org>2015-02-25 01:08:35 +0545
commite173dd74fd009a4771552fb0e2cb3ee508072d30 (patch)
treebea5145e029d123a60deef2758f6563fcceb1fed /etc/rc.bootup
parentb8b3784f243f8f8a372cf976fa2385ca1e14e80c (diff)
downloadpfsense-e173dd74fd009a4771552fb0e2cb3ee508072d30.zip
pfsense-e173dd74fd009a4771552fb0e2cb3ee508072d30.tar.gz
Code style for etc files
Diffstat (limited to 'etc/rc.bootup')
-rwxr-xr-xetc/rc.bootup101
1 files changed, 56 insertions, 45 deletions
diff --git a/etc/rc.bootup b/etc/rc.bootup
index 1adbe15..ef26679 100755
--- a/etc/rc.bootup
+++ b/etc/rc.bootup
@@ -38,8 +38,8 @@ function rescue_detect_keypress() {
// How long do you want the script to wait before moving on (in seconds)
$timeout=9;
echo "\n";
- echo "[ Press R to enter recovery mode or ]\n";
- echo "[ press I to launch the installer ]\n\n";
+ echo "[ Press R to enter recovery mode or ]\n";
+ echo "[ press I to launch the installer ]\n\n";
echo "(R)ecovery mode can assist by rescuing config.xml\n";
echo "from a broken hard disk installation, etc.\n\n";
echo "(I)nstaller may be invoked now if you do \n";
@@ -48,30 +48,31 @@ function rescue_detect_keypress() {
echo "Timeout before auto boot continues (seconds): {$timeout}";
$key = null;
exec("/bin/stty erase " . chr(8));
- while(!in_array($key, array("c", "C", "r","R", "i", "I", "~", "!"))) {
- echo chr(8) . "{$timeout}";
- `/bin/stty -icanon min 0 time 25`;
- $key = trim(`KEY=\`dd count=1 2>/dev/null\`; echo \$KEY`);
- `/bin/stty icanon`;
- // Decrement our timeout value
- $timeout--;
- // If we have reached 0 exit and continue on
- if ($timeout == 0)
- break;
+ while (!in_array($key, array("c", "C", "r","R", "i", "I", "~", "!"))) {
+ echo chr(8) . "{$timeout}";
+ `/bin/stty -icanon min 0 time 25`;
+ $key = trim(`KEY=\`dd count=1 2>/dev/null\`; echo \$KEY`);
+ `/bin/stty icanon`;
+ // Decrement our timeout value
+ $timeout--;
+ // If we have reached 0 exit and continue on
+ if ($timeout == 0) {
+ break;
+ }
}
// If R or I was pressed do our logic here
if (in_array($key, array("r", "R"))) {
- putenv("TERM=cons25");
- echo "\n\nRecovery mode selected...\n";
- passthru("/usr/bin/env TERM=cons25 /bin/tcsh -c /scripts/lua_installer_rescue");
+ putenv("TERM=cons25");
+ echo "\n\nRecovery mode selected...\n";
+ passthru("/usr/bin/env TERM=cons25 /bin/tcsh -c /scripts/lua_installer_rescue");
} elseif (in_array($key, array("i", "I"))) {
- putenv("TERM=cons25");
- echo "\n\nInstaller mode selected...\n";
- passthru("/usr/bin/env TERM=cons25 /bin/tcsh -c /scripts/lua_installer");
- if(file_exists("/tmp/install_complete")) {
- passthru("/etc/rc.reboot");
- exit;
- }
+ putenv("TERM=cons25");
+ echo "\n\nInstaller mode selected...\n";
+ passthru("/usr/bin/env TERM=cons25 /bin/tcsh -c /scripts/lua_installer");
+ if (file_exists("/tmp/install_complete")) {
+ passthru("/etc/rc.reboot");
+ exit;
+ }
} elseif (in_array($key, array("!", "~"))) {
putenv("TERM=cons25");
echo "\n\nRecovery shell selected...\n";
@@ -141,8 +142,9 @@ system_dmesg_save();
system_check_reset_button();
/* remove previous firmware upgrade if present */
-if (file_exists("/root/firmware.tgz"))
+if (file_exists("/root/firmware.tgz")) {
unlink("/root/firmware.tgz");
+}
/* start devd (dhclient now uses it) */
echo "Starting device manager (devd)...";
@@ -153,14 +155,15 @@ unmute_kernel_msgs();
echo "done.\n";
// Display rescue configuration option
-if($g['platform'] == "cdrom")
- rescue_detect_keypress();
+if ($g['platform'] == "cdrom") {
+ rescue_detect_keypress();
+}
echo "Loading configuration...";
parse_config_bootup();
echo "done.\n";
-if($g['platform'] == "jail") {
+if ($g['platform'] == "jail") {
/* We must determine what network settings have been configured for us */
$wanif = "lo0"; /* defaults, if the jail admin hasn't set us up */
$ipaddr = "127.0.0.1";
@@ -181,28 +184,32 @@ if($g['platform'] == "jail") {
$config['interfaces']['wan']['ipaddr'] = $ipaddr;
$config['interfaces']['wan']['subnet'] = "32"; /* XXX right? */
$config['interfaces']['wan']['enable'] = true;
- if($config['dhcpd']['lan'])
+ if ($config['dhcpd']['lan']) {
unset($config['dhcpd']['lan']['enable']);
+ }
unlink_if_exists('/conf/trigger_initial_wizard');
write_config();
} else {
/*
- * Determine if we need to throw a interface exception
- * and ask the user to reassign interfaces. This will
- * avoid a reboot and thats a good thing.
+ * Determine if we need to throw a interface exception
+ * and ask the user to reassign interfaces. This will
+ * avoid a reboot and that is a good thing.
*/
- while(is_interface_mismatch() == true) {
+ while (is_interface_mismatch() == true) {
led_assigninterfaces();
if (isset($config['revision'])) {
- if (file_exists("{$g['tmp_path']}/missing_interfaces"))
+ if (file_exists("{$g['tmp_path']}/missing_interfaces")) {
echo "Warning: Configuration references interfaces that do not exist: " . file_get_contents("{$g['tmp_path']}/missing_interfaces") . "\n";
+ }
echo "\nNetwork interface mismatch -- Running interface assignment option.\n";
- } else
+ } else {
echo "\nDefault interfaces not found -- Running interface assignment option.\n";
+ }
$ifaces = get_interface_list();
if (is_array($ifaces)) {
- foreach($ifaces as $iface => $ifdata)
+ foreach ($ifaces as $iface => $ifdata) {
interfaces_bring_up($iface);
+ }
}
set_networking_interfaces_ports();
led_kitt();
@@ -262,12 +269,14 @@ setup_microcode();
echo "done.\n";
/* set up interfaces */
-if(!$debugging)
+if (!$debugging) {
mute_kernel_msgs();
+}
interfaces_configure();
interfaces_sync_setup();
-if(!$debugging)
+if (!$debugging) {
unmute_kernel_msgs();
+}
/* re-make hosts file after configuring interfaces */
system_hosts_generate();
@@ -297,7 +306,7 @@ echo "Synchronizing user settings...";
local_sync_accounts();
echo "done.\n";
-if($realmem > 0 and $realmem < 65) {
+if ($realmem > 0 and $realmem < 65) {
echo "System has less than 65 megabytes of ram {$realmem}. Delaying webConfigurator startup.\n";
/* start webConfigurator up on final pass */
mwexec("/usr/local/sbin/pfSctl -c 'service restart webgui'");
@@ -339,7 +348,7 @@ system_console_configure();
/* start DHCP service */
services_dhcpd_configure();
-/* start dhcpleases dhpcp hosts leases program */
+/* start dhcpleases dhcp hosts leases program */
system_dhcpleases_configure();
/* start DHCP relay */
@@ -385,12 +394,12 @@ enable_rrd_graphing();
enable_watchdog();
/* if <system><afterbootupshellcmd> exists, execute the command */
-if($config['system']['afterbootupshellcmd'] <> "") {
+if ($config['system']['afterbootupshellcmd'] <> "") {
echo "Running afterbootupshellcmd {$config['system']['afterbootupshellcmd']}\n";
mwexec($config['system']['afterbootupshellcmd']);
}
-if($physmem < $g['minimum_ram_warning']) {
+if ($physmem < $g['minimum_ram_warning']) {
require_once("/etc/inc/notices.inc");
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);
set_sysctl(array(
@@ -404,8 +413,9 @@ if($physmem < $g['minimum_ram_warning']) {
$kern_hz = get_single_sysctl('kern.clockrate');
$kern_hz = substr($kern_hz, strpos($kern_hz, "hz = ") + 5);
$kern_hz = substr($kern_hz, 0, strpos($kern_hz, ","));
-if($kern_hz == "1000")
+if ($kern_hz == "1000") {
set_single_sysctl("net.inet.tcp.rexmit_min" , "30");
+}
/* start the igmpproxy daemon */
services_igmpproxy_configure();
@@ -420,14 +430,15 @@ activate_powerd();
prefer_ipv4_or_ipv6();
/* Remove the old shutdown binary if we kept it. */
-if (file_exists("/sbin/shutdown.old"))
+if (file_exists("/sbin/shutdown.old")) {
@unlink("/sbin/shutdown.old");
+}
/* Resync / Reinstall packages if need be */
-if(file_exists('/conf/needs_package_sync')) {
- if($config['installedpackages'] <> '' && is_array($config['installedpackages']['package'])) {
+if (file_exists('/conf/needs_package_sync')) {
+ if ($config['installedpackages'] <> '' && is_array($config['installedpackages']['package'])) {
require_once("pkg-utils.inc");
- if($g['platform'] == "pfSense" || $g['platform'] == "nanobsd") {
+ if ($g['platform'] == "pfSense" || $g['platform'] == "nanobsd") {
mark_subsystem_dirty('packagelock');
pkg_reinstall_all();
clear_subsystem_dirty('packagelock');
OpenPOWER on IntegriCloud