diff options
author | Ermal LUÇI <eri@pfsense.org> | 2014-11-26 13:10:01 +0100 |
---|---|---|
committer | Ermal LUÇI <eri@pfsense.org> | 2014-11-26 13:10:01 +0100 |
commit | 285ef132f7d671620f269a57d2ebcff585d2a493 (patch) | |
tree | b491fad66d22765d9640b2ac543c41b6e417a95d | |
parent | 32e834ffd3b4cc6cdc6b147c91cb6dbcb0a93288 (diff) | |
download | pfsense-285ef132f7d671620f269a57d2ebcff585d2a493.zip pfsense-285ef132f7d671620f269a57d2ebcff585d2a493.tar.gz |
Rather than set the g['booting'] on globals provide a function to test for that doing the right checks
-rw-r--r-- | etc/inc/captiveportal.inc | 8 | ||||
-rw-r--r-- | etc/inc/config.console.inc | 4 | ||||
-rw-r--r-- | etc/inc/config.inc | 43 | ||||
-rw-r--r-- | etc/inc/config.lib.inc | 27 | ||||
-rw-r--r-- | etc/inc/filter.inc | 22 | ||||
-rw-r--r-- | etc/inc/globals.inc | 15 | ||||
-rw-r--r-- | etc/inc/gwlb.inc | 2 | ||||
-rw-r--r-- | etc/inc/interfaces.inc | 66 | ||||
-rw-r--r-- | etc/inc/ipsec.inc | 2 | ||||
-rw-r--r-- | etc/inc/notices.inc | 2 | ||||
-rw-r--r-- | etc/inc/openvpn.inc | 2 | ||||
-rw-r--r-- | etc/inc/pkg-utils.inc | 4 | ||||
-rw-r--r-- | etc/inc/rrd.inc | 34 | ||||
-rw-r--r-- | etc/inc/services.inc | 40 | ||||
-rw-r--r-- | etc/inc/system.inc | 26 | ||||
-rw-r--r-- | etc/inc/upgrade_config.inc | 12 | ||||
-rw-r--r-- | etc/inc/voucher.inc | 6 | ||||
-rw-r--r-- | etc/inc/vpn.inc | 18 | ||||
-rwxr-xr-x | etc/rc.filter_synchronize | 7 | ||||
-rwxr-xr-x | etc/rc.kill_states | 4 | ||||
-rwxr-xr-x | etc/rc.linkup | 3 | ||||
-rwxr-xr-x | etc/rc.newwanip | 2 | ||||
-rwxr-xr-x | etc/rc.newwanipv6 | 2 |
23 files changed, 175 insertions, 176 deletions
diff --git a/etc/inc/captiveportal.inc b/etc/inc/captiveportal.inc index f7aa1dd..cf529f9 100644 --- a/etc/inc/captiveportal.inc +++ b/etc/inc/captiveportal.inc @@ -186,7 +186,7 @@ function captiveportal_configure_zone($cpcfg) { if (isset($cpcfg['enable'])) { - if ($g['booting']) { + if (platform_booting()) { echo "Starting captive portal({$cpcfg['zone']})... "; /* remove old information */ @@ -332,7 +332,7 @@ EOD; unlink_if_exists("{$g['vardb_path']}/captiveportal_radius_{$cpzone}.db"); captiveportal_init_radius_servers(); - if ($g['booting']) { + if (platform_booting()) { /* send Accounting-On to server */ captiveportal_send_server_accounting(); echo "done\n"; @@ -349,7 +349,7 @@ EOD; captiveportal_radius_stop_all(); /* send Accounting-Off to server */ - if (!$g['booting']) { + if (!platform_booting()) { captiveportal_send_server_accounting(true); } @@ -1045,7 +1045,7 @@ function captiveportal_allowedip_configure_entry($ipent, $ishostname = false) { * easy such as hostname vs ip address add this check */ if ($ishostname === true) { - if (!$g['booting']) { + if (!platform_booting()) { $ipaddress = gethostbyname($ipent['hostname']); if (!is_ipaddr($ipaddress)) return; diff --git a/etc/inc/config.console.inc b/etc/inc/config.console.inc index 6c956fb..ccfdfaf 100644 --- a/etc/inc/config.console.inc +++ b/etc/inc/config.console.inc @@ -313,7 +313,7 @@ EOD; $config['interfaces']['lan'] = array(); $config['interfaces']['lan']['if'] = $lanif; $config['interfaces']['lan']['enable'] = true; - } elseif (!$g['booting'] && !$auto_assign) { + } elseif (!platform_booting() && !$auto_assign) { echo <<<EODD @@ -411,7 +411,7 @@ EODD; fclose($fp); - if($g['booting']) + if(platform_booting()) return; echo gettext("One moment while we reload the settings..."); diff --git a/etc/inc/config.inc b/etc/inc/config.inc index 91757bf..3b75d1e 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -42,12 +42,7 @@ pfSense_MODULE: config */ -if (php_sapi_name() == 'fpm-fcgi') { - require_once("config.gui.inc"); - return; -} - -if($g['booting']) echo "."; +if(platform_booting()) echo "."; /* do not load this file twice. */ //if (in_array("/etc/inc/config.inc", get_included_files())) @@ -67,22 +62,22 @@ else /* include globals from notices.inc /utility/XML parser files */ require_once("notices.inc"); -if($g['booting']) echo "."; +if(platform_booting()) echo "."; require_once("util.inc"); -if($g['booting']) echo "."; +if(platform_booting()) echo "."; require_once("IPv6.inc"); -if($g['booting']) echo "."; +if(platform_booting()) echo "."; require_once('config.lib.inc'); -if($g['booting']) echo "."; +if(platform_booting()) echo "."; if(file_exists("/cf/conf/use_xmlreader")) require_once("xmlreader.inc"); else require_once("xmlparse.inc"); -if($g['booting']) echo "."; +if(platform_booting()) echo "."; require_once("crypt.inc"); /* read platform */ -if($g['booting']) echo "."; +if(platform_booting()) echo "."; if (file_exists("{$g['etc_path']}/platform")) { $g['platform'] = chop(file_get_contents("{$g['etc_path']}/platform")); } else { @@ -96,11 +91,11 @@ if(file_exists("/debugging")) { $g['debug'] = true; } -if($g['booting']) echo "."; -if($g['booting'] && file_exists("/cf/conf/config.xml")) { +if(platform_booting()) echo "."; +if(platform_booting() && file_exists("/cf/conf/config.xml")) { $config_contents = file_get_contents("/cf/conf/config.xml"); if(stristr($config_contents, "<m0n0wall>") == true) { - if($g['booting']) echo "."; + if(platform_booting()) echo "."; /* user has just upgraded to m0n0wall, replace root xml tags */ log_error(gettext("Upgrading m0n0wall configuration to pfSense... ")); $config_contents = str_replace("m0n0wall","pfsense", $config_contents); @@ -115,14 +110,14 @@ if($g['booting'] && file_exists("/cf/conf/config.xml")) { } /* if our config file exists bail out, we're already set. */ -else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) { - if($g['booting']) echo "."; +else if (platform_booting() and !file_exists($g['cf_conf_path'] . "/config.xml") ) { + if(platform_booting()) echo "."; /* find the device where config.xml resides and write out an fstab */ unset($cfgdevice); - if($g['booting']) echo "."; + if(platform_booting()) echo "."; /* check if there's already an fstab (NFS booting?) */ if (!file_exists("{$g['etc_path']}/fstab")) { - if($g['booting']) echo "."; + if(platform_booting()) echo "."; if (strstr($g['platform'], "cdrom")) { /* config is on floppy disk for CD-ROM version */ $cfgdevice = $cfgpartition = "fd0"; @@ -140,7 +135,7 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) { echo " " . gettext("CFG:") . " {$cfgpartition}\n"; echo " " . gettext("TYPE:") . " {$cfgfstype}\n"; } else { - if($g['booting']) echo "."; + if(platform_booting()) echo "."; /* probe kernel known disks until we find one with config.xml */ $disks = explode(" ", get_single_sysctl("kern.disks")); foreach ($disks as $mountdisk) { @@ -162,7 +157,7 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) { break; } if (mwexec("/sbin/mount -r /dev/{$mountdisk}d {$g['cf_path']}") == 0) { - if($g['booting']) echo "."; + if(platform_booting()) echo "."; if (file_exists("{$g['cf_conf_path']}/config.xml")) { /* found it */ $cfgdevice = $mountdisk; @@ -178,7 +173,7 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) { } } } - if($g['booting']) echo "."; + if(platform_booting()) echo "."; if (!$cfgdevice) { $last_backup = discover_last_backup(); if($last_backup) { @@ -205,12 +200,12 @@ else if ($g['booting'] and !file_exists($g['cf_conf_path'] . "/config.xml") ) { fwrite($fd, $fstab); fclose($fd); } - if($g['booting']) echo "."; + if(platform_booting()) echo "."; /* mount all filesystems */ mwexec("/sbin/mount -a"); } -if($g['booting']) echo "."; +if(platform_booting()) echo "."; $config = parse_config(); /* set timezone */ diff --git a/etc/inc/config.lib.inc b/etc/inc/config.lib.inc index a7f6cbf..63e36e9 100644 --- a/etc/inc/config.lib.inc +++ b/etc/inc/config.lib.inc @@ -57,7 +57,7 @@ function encrypted_configxml() { if (!file_exists($g['conf_path'] . "/config.xml")) return; - if (!$g['booting']) + if (!platform_booting()) return; $configtxt = file_get_contents($g['conf_path'] . "/config.xml"); @@ -111,7 +111,7 @@ function parse_config($parse = false) { } } - if($g['booting']) + if (platform_booting()) echo "."; // Check for encrypted config.xml @@ -127,7 +127,7 @@ function parse_config($parse = false) { } if ($parse == true) { if(!file_exists($g['conf_path'] . "/config.xml")) { - if($g['booting']) + if (platform_booting()) echo "."; log_error("No config.xml found, attempting last known config restore."); file_notice("config.xml", "No config.xml found, attempting last known config restore.", "pfSenseConfigurator", ""); @@ -154,7 +154,7 @@ function parse_config($parse = false) { generate_config_cache($config); } - if($g['booting']) + if (platform_booting()) echo "."; $config_parsed = true; @@ -226,12 +226,12 @@ function restore_backup($file) { function parse_config_bootup() { global $config, $g; - if($g['booting']) + if (platform_booting()) echo "."; $lockkey = lock('config'); if (!file_exists("{$g['conf_path']}/config.xml")) { - if ($g['booting']) { + if (platform_booting()) { if (strstr($g['platform'], "cdrom")) { /* try copying the default config. to the floppy */ echo gettext("Resetting factory defaults...") . "\n"; @@ -319,7 +319,7 @@ function conf_mount_rw() { $status = mwexec("/sbin/mount -u -w -o sync,noatime {$g['cf_path']}"); if($status <> 0) { - if($g['booting']) + if (platform_booting()) echo gettext("Disk is dirty. Running fsck -y") . "\n"; mwexec("/sbin/fsck -y {$g['cf_path']}"); $status = mwexec("/sbin/mount -u -w -o sync,noatime {$g['cf_path']}"); @@ -360,7 +360,7 @@ function conf_mount_ro() { if(isset($config['system']['nanobsd_force_rw'])) return; - if($g['booting']) + if (platform_booting()) return; clear_subsystem_dirty('mount'); @@ -423,7 +423,7 @@ function convert_config() { if (function_exists($migration_function)) $migration_function(); $config['version'] = sprintf('%.1f', $next / 10); - if($g['booting']) + if (platform_booting()) echo "."; } @@ -539,7 +539,7 @@ function write_config($desc="Unknown", $backup = true) { if ($last_backup) { restore_backup("/cf/conf/backup/{$last_backup}"); $config = parse_xml_config("{$g['conf_path']}/config.xml", $g['xml_rootobj']); - if ($g['booting']) { + if (platform_booting()) { echo "\n\n ************** WARNING **************"; echo "\n\n Configuration could not be validated. A previous configuration was restored. \n"; echo "\n The failed configuration file has been saved as {$g['conf_path']}/config.xml.bad \n\n"; @@ -644,7 +644,7 @@ function config_install($conffile) { if (!config_validate("{$conffile}")) return 1; - if($g['booting'] == true) + if (platform_booting()) echo gettext("Installing configuration...") . "\n"; else log_error(gettext("Installing configuration ....")); @@ -752,7 +752,7 @@ function cleanup_backupcache($lock = false) { unset($backupexp); if(!in_array($tocheck, $baktimes)) { $i = true; - if($g['booting']) + if (platform_booting()) echo "."; $newxml = parse_xml_config($backup, array($g['xml_rootobj'], 'pfsense')); if($newxml == "-1") { @@ -773,7 +773,7 @@ function cleanup_backupcache($lock = false) { $newbaks[] = $checkbak; } else { $i = true; - if($g['booting']) print " " . $tocheck . "r"; + if (platform_booting()) print " " . $tocheck . "r"; } } foreach($newbaks as $todo) $tocache[$todo['time']] = array('description' => $todo['description'], 'version' => $todo['version'], 'filesize' => $todo['filesize']); @@ -784,7 +784,6 @@ function cleanup_backupcache($lock = false) { foreach($tocache as $version => $versioninfo) { if(!in_array($version, array_keys($newcache))) { unlink_if_exists($g['conf_path'] . '/backup/config-' . $version . '.xml'); - //if($g['booting']) print " " . $tocheck . "d"; } } $tocache = $newcache; diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 7fec630..269aa30 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -116,7 +116,7 @@ function filter_configure() { * NOTE: Check here for bootup status since this should not be triggered during bootup. * The reason is that rc.bootup calls filter_configure_sync directly which does this too. */ - if (!$g['booting']) + if (!platform_booting()) send_event("filter reload"); } @@ -170,16 +170,16 @@ function filter_configure_sync($delete_states_if_needed = true) { } /* Get interface list to work with. */ filter_generate_optcfg_array(); - if($g['booting'] == true) + if(platform_booting() == true) echo gettext("Configuring firewall"); /* generate aliases */ - if($g['booting'] == true) + if(platform_booting() == true) echo "."; update_filter_reload_status(gettext("Creating aliases")); $aliases = filter_generate_aliases(); $gateways = filter_generate_gateways(); - if($g['booting'] == true) + if(platform_booting() == true) echo "."; update_filter_reload_status(gettext("Generating Limiter rules")); $dummynet_rules = filter_generate_dummynet_rules(); @@ -187,19 +187,19 @@ function filter_configure_sync($delete_states_if_needed = true) { update_filter_reload_status(gettext("Generating NAT rules")); /* generate nat rules */ $natrules = filter_nat_rules_generate(); - if($g['booting'] == true) + if(platform_booting() == true) echo "."; update_filter_reload_status(gettext("Generating filter rules")); /* generate pfctl rules */ $pfrules = filter_rules_generate(); /* generate altq, limiter */ - if($g['booting'] == true) + if(platform_booting() == true) echo "."; update_filter_reload_status(gettext("Generating ALTQ queues")); $altq_queues = filter_generate_altq_queues(); update_filter_reload_status(gettext("Generating Layer7 rules")); generate_layer7_files(); - if($g['booting'] == true) + if(platform_booting() == true) echo "."; update_filter_reload_status(gettext("Loading filter rules")); /* enable pf if we need to, otherwise disable */ @@ -209,7 +209,7 @@ function filter_configure_sync($delete_states_if_needed = true) { mwexec("/sbin/pfctl -d", true); unlink_if_exists("{$g['tmp_path']}/filter_loading"); update_filter_reload_status(gettext("Filter is disabled. Not loading rules.")); - if($g['booting'] == true) + if(platform_booting() == true) echo gettext("done.") . "\n"; unlock($filterlck); return; @@ -379,7 +379,7 @@ function filter_configure_sync($delete_states_if_needed = true) { else filter_tdr_install_cron(false); - if($g['booting'] == true) + if(platform_booting() == true) echo "."; if($delete_states_if_needed) { @@ -397,7 +397,7 @@ function filter_configure_sync($delete_states_if_needed = true) { } update_filter_reload_status(gettext("Done")); - if($g['booting'] == true) + if(platform_booting() == true) echo gettext("done.") . "\n"; unlock($filterlck); @@ -3349,7 +3349,7 @@ function tdr_install_cron($should_install) { function filter_tdr_install_cron($should_install) { global $config, $g; - if($g['booting']==true) + if(platform_booting()==true) return; if (!is_array($config['cron'])) diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc index aa6b5e3..1bd832b 100644 --- a/etc/inc/globals.inc +++ b/etc/inc/globals.inc @@ -165,10 +165,17 @@ $sysctls = array("net.inet.ip.portrange.first" => "1024", if (file_exists("/etc/inc/globals_override.inc")) @include("globals_override.inc"); -if (file_exists("{$g['varrun_path']}/booting")) - $g['booting'] = true; -else - unset($g['booting']); +function platform_booting() { + global $g; + + if (file_exists("{$g['varrun_path']}/booting")) + return true; + + if ($g['booting']) + return true; + + return false; +} $config_parsed = false; diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 744dee8..33ec09c 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -867,7 +867,7 @@ function return_gateway_groups_array() { $tiers_count = count($tiers); if ($tiers_count == 0) { /* Oh dear, we have no members! Engage Plan B */ - if (!$g['booting']) { + if (!platform_booting()) { $msg = gettext("Gateways status could not be determined, considering all as up/active. (Group: {$group['name']})"); log_error($msg); notify_via_growl($msg); diff --git a/etc/inc/interfaces.inc b/etc/inc/interfaces.inc index e6627e8..22ddb25 100644 --- a/etc/inc/interfaces.inc +++ b/etc/inc/interfaces.inc @@ -204,18 +204,18 @@ function interfaces_loopback_configure() { if ($g['platform'] == 'jail') return; - if($g['booting']) + if (platform_booting()) echo gettext("Configuring loopback interface..."); pfSense_interface_setaddress("lo0", "127.0.0.1"); interfaces_bring_up("lo0"); - if($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; return 0; } function interfaces_vlan_configure($realif = "") { global $config, $g; - if($g['booting']) + if (platform_booting()) echo gettext("Configuring VLAN interfaces..."); if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) { foreach ($config['vlans']['vlan'] as $vlan) { @@ -228,7 +228,7 @@ function interfaces_vlan_configure($realif = "") { interface_vlan_configure($vlan); } } - if($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; } @@ -352,7 +352,7 @@ function interface_qinq_configure(&$vlan, $fd = NULL) { function interfaces_qinq_configure() { global $config, $g; - if($g['booting']) + if (platform_booting()) echo gettext("Configuring QinQ interfaces..."); if (is_array($config['qinqs']['qinqentry']) && count($config['qinqs']['qinqentry'])) { foreach ($config['qinqs']['qinqentry'] as $qinq) { @@ -360,7 +360,7 @@ function interfaces_qinq_configure() { interface_qinq_configure($qinq); } } - if($g['booting']) + if (platform_booting()) echo gettext( "done.") . "\n"; } @@ -396,7 +396,7 @@ function interface_qinq2_configure(&$qinq, $fd, $macaddr) { function interfaces_create_wireless_clones() { global $config, $g; - if($g['booting']) + if (platform_booting()) echo gettext("Creating wireless clone interfaces..."); $iflist = get_configured_interface_list(); @@ -417,7 +417,7 @@ function interfaces_create_wireless_clones() { interface_wireless_clone($clone['cloneif'], $clone); } } - if($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; } @@ -500,7 +500,7 @@ function interface_bridge_configure(&$bridge, $checkmember = 0) { if ($smallermtu == 0) $smallermtu = 1500; - if ($g['booting'] || !empty($bridge['bridgeif'])) { + if (platform_booting() || !empty($bridge['bridgeif'])) { pfSense_interface_destroy($bridge['bridgeif']); pfSense_interface_create($bridge['bridgeif']); $bridgeif = escapeshellarg($bridge['bridgeif']); @@ -657,7 +657,7 @@ function interface_bridge_add_member($bridgeif, $interface, $flagsapplied = fals function interfaces_lagg_configure($realif = "") { global $config, $g; - if($g['booting']) + if (platform_booting()) echo gettext("Configuring LAGG interfaces..."); $i = 0; if (is_array($config['laggs']['lagg']) && count($config['laggs']['lagg'])) { @@ -671,7 +671,7 @@ function interfaces_lagg_configure($realif = "") { $i++; } } - if($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; } @@ -685,7 +685,7 @@ function interface_lagg_configure($lagg) { if (!count($members)) return -1; - if ($g['booting'] || !(empty($lagg['laggif']))) { + if (platform_booting() || !(empty($lagg['laggif']))) { pfSense_interface_destroy($lagg['laggif']); pfSense_interface_create($lagg['laggif']); $laggif = $lagg['laggif']; @@ -771,7 +771,7 @@ function interface_gre_configure(&$gre, $grekey = "") { /* make sure the parent interface is up */ interfaces_bring_up($realif); - if ($g['booting'] || !(empty($gre['greif']))) { + if (platform_booting() || !(empty($gre['greif']))) { pfSense_interface_destroy($gre['greif']); pfSense_interface_create($gre['greif']); $greif = $gre['greif']; @@ -868,7 +868,7 @@ function interface_gif_configure(&$gif, $gifkey = "") { else log_error(gettext("could not bring realif up -- variable not defined -- interface_gif_configure()")); - if ($g['booting'] || !(empty($gif['gifif']))) { + if (platform_booting() || !(empty($gif['gifif']))) { pfSense_interface_destroy($gif['gifif']); pfSense_interface_create($gif['gifif']); $gifif = $gif['gifif']; @@ -893,7 +893,7 @@ function interface_gif_configure(&$gif, $gifkey = "") { else log_error(gettext("could not bring gifif up -- variable not defined")); - if (!$g['booting']) { + if (!platform_booting()) { $iflist = get_configured_interface_list(); foreach($iflist as $ifname) { if($config['interfaces'][$ifname]['if'] == $gifif) { @@ -954,7 +954,7 @@ function interfaces_configure() { /* This is needed to speedup interfaces on bootup. */ $reload = false; - if (!$g['booting']) + if (!platform_booting()) $reload = true; foreach($iflist as $if => $ifname) { @@ -971,13 +971,13 @@ function interfaces_configure() { } else if (!empty($config['interfaces'][$if]['ipaddrv6']) && $config['interfaces'][$if]['ipaddrv6'] == "track6") { $track6_list[$if] = $ifname; } else { - if ($g['booting']) + if (platform_booting()) printf(gettext("Configuring %s interface..."), $ifname); if($g['debug']) log_error(sprintf(gettext("Configuring %s"), $ifname)); interface_configure($if, $reload); - if ($g['booting']) + if (platform_booting()) echo gettext( "done.") . "\n"; } } @@ -998,14 +998,14 @@ function interfaces_configure() { interfaces_bridge_configure(1); foreach ($track6_list as $if => $ifname) { - if ($g['booting']) + if (platform_booting()) printf(gettext("Configuring %s interface..."), $ifname); if ($g['debug']) log_error(sprintf(gettext("Configuring %s"), $ifname)); interface_configure($if, $reload); - if ($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; } @@ -1019,14 +1019,14 @@ function interfaces_configure() { interfaces_gif_configure(2); foreach ($delayed_list as $if => $ifname) { - if ($g['booting']) + if (platform_booting()) printf(gettext("Configuring %s interface..."), $ifname); if ($g['debug']) log_error(sprintf(gettext("Configuring %s"), $ifname)); interface_configure($if, $reload); - if ($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; } @@ -1034,21 +1034,21 @@ function interfaces_configure() { interfaces_bridge_configure(2); foreach ($bridge_list as $if => $ifname) { - if ($g['booting']) + if (platform_booting()) printf(gettext("Configuring %s interface..."), $ifname); if($g['debug']) log_error(sprintf(gettext("Configuring %s"), $ifname)); interface_configure($if, $reload); - if ($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; } /* configure interface groups */ interfaces_group_setup(); - if (!$g['booting']) { + if (!platform_booting()) { /* reconfigure static routes (kernel may have deleted them) */ system_routing_configure(); @@ -1450,7 +1450,7 @@ function interface_ppps_configure($interface) { $type = $ppp['type']; $upper_type = strtoupper($ppp['type']); - if($g['booting']) { + if (platform_booting()) { $descr = isset($ifcfg['descr']) ? $ifcfg['descr'] : strtoupper($interface); echo "starting {$pppif} link..."; // Do not re-configure the interface if we are booting and it's already been started @@ -1861,7 +1861,7 @@ function interfaces_sync_setup() { echo "interfaces_sync_setup() being called $mt\n"; } - if ($g['booting']) { + if (platform_booting()) { echo gettext("Configuring CARP settings..."); mute_kernel_msgs(); } @@ -1917,7 +1917,7 @@ function interfaces_sync_setup() { else set_single_sysctl("net.inet.carp.allow", "0"); - if ($g['booting']) { + if (platform_booting()) { unmute_kernel_msgs(); echo gettext("done.") . "\n"; } @@ -2854,7 +2854,7 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven // Need code to handle MLPPP if we ever use $realhwif for MLPPP handling $realhwif = $realhwif_array[0]; - if (!$g['booting'] && !(substr($realif, 0, 4) == "ovpn")) { + if (!platform_booting() && !(substr($realif, 0, 4) == "ovpn")) { /* remove all IPv4 and IPv6 addresses */ $tmpifaces = pfSense_getall_interface_addresses($realif); if (is_array($tmpifaces)) { @@ -3038,7 +3038,7 @@ function interface_configure($interface = "wan", $reloadall = false, $linkupeven interface_netgraph_needed($interface); - if (!$g['booting']) { + if (!platform_booting()) { link_interface_to_vips($interface, "update"); unset($gre); @@ -3148,7 +3148,7 @@ function interface_track6_configure($interface = "lan", $wancfg, $linkupevent = break; } - if (!$g['booting'] && $linkupevent == false) { + if (!platform_booting() && $linkupevent == false) { if (!function_exists('services_dhcpd_configure')) require_once("services.inc"); @@ -3346,7 +3346,7 @@ function interface_6rd_configure($interface = "wan", $wancfg) { mwexec("/sbin/route change -host " . escapeshellarg($wancfg['gateway-6rd']) . " {$ip4gateway}"); /* configure dependent interfaces */ - if (!$g['booting']) + if (!platform_booting()) link_interface_to_track6($interface, "update"); return 0; @@ -3442,7 +3442,7 @@ function interface_6to4_configure($interface = "wan", $wancfg){ if (is_ipaddrv4($ip4gateway)) mwexec("/sbin/route change -host 192.88.99.1 {$ip4gateway}"); - if (!$g['booting']) + if (!platform_booting()) link_interface_to_track6($interface, "update"); return 0; diff --git a/etc/inc/ipsec.inc b/etc/inc/ipsec.inc index f2eaa06..959aead 100644 --- a/etc/inc/ipsec.inc +++ b/etc/inc/ipsec.inc @@ -197,7 +197,7 @@ function ipsec_get_phase1_dst(& $ph1ent) { return false; $rg = $ph1ent['remote-gateway']; if (!is_ipaddr($rg)) { - if(! $g['booting']) + if(! platform_booting()) return resolve_retry($rg); } if(!is_ipaddr($rg)) diff --git a/etc/inc/notices.inc b/etc/inc/notices.inc index ea8d220..5bffce2 100644 --- a/etc/inc/notices.inc +++ b/etc/inc/notices.inc @@ -267,7 +267,7 @@ function are_notices_pending($category = "all") { ******/ function notify_via_smtp($message, $force = false) { global $config, $g; - if($g['booting']) + if(platform_booting()) return; if(isset($config['notifications']['smtp']['disable']) && !$force) diff --git a/etc/inc/openvpn.inc b/etc/inc/openvpn.inc index 81d971d..7582d30 100644 --- a/etc/inc/openvpn.inc +++ b/etc/inc/openvpn.inc @@ -875,7 +875,7 @@ function openvpn_restart($mode, $settings) { openvpn_clear_route($mode, $settings); mwexec_bg("/usr/local/sbin/openvpn --config " . escapeshellarg($fpath)); - if (!$g['booting']) + if (!platform_booting()) send_event("filter reload"); } diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index 3bccf1b..690d2f6 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -232,7 +232,7 @@ function resync_all_package_configs($show_message = false) { if($show_message == true) echo " " . $package['name']; get_pkg_depends($package['name'], "all"); - if($g['booting'] != true) + if(platform_booting() != true) stop_service(get_pkg_internal_name($package)); sync_package($idx, true, true); if($pkg_interface == "console") @@ -1020,7 +1020,7 @@ function delete_package_xml($pkg) { foreach($pkg_config['service'] as $service) { foreach($services as $key => $instservice) { if($instservice['name'] == $service['name']) { - if($g['booting'] != true) + if(platform_booting() != true) stop_service($service['name']); if($service['rcfile']) { $prefix = RCFILEPREFIX; diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc index 6e64815..a5742e3 100644 --- a/etc/inc/rrd.inc +++ b/etc/inc/rrd.inc @@ -200,7 +200,7 @@ function migrate_rrd_format($rrdoldxml, $rrdnewxml) { function enable_rrd_graphing() { global $config, $g, $altq_list_queues; - if($g['booting']) + if(platform_booting()) echo gettext("Generating RRD graphs..."); $rrddbpath = "/var/db/rrd/"; @@ -282,7 +282,7 @@ function enable_rrd_graphing() { } chown($rrddbpath, "nobody"); - if ($g['booting']) { + if (platform_booting()) { restore_rrd(); } @@ -338,7 +338,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(platform_booting()) { mwexec("$rrdtool update $rrddbpath$ifname$traffic N:U:U:U:U:U:U:U:U"); } @@ -371,7 +371,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(platform_booting()) { mwexec("$rrdtool update $rrddbpath$ifname$packets N:U:U:U:U:U:U:U:U"); } @@ -400,7 +400,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(platform_booting()) { mwexec("$rrdtool update $rrddbpath$ifname$wireless N:U:U:U"); } @@ -425,7 +425,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(platform_booting()) { mwexec("$rrdtool update $rrddbpath$ifname$vpnusers N:U"); } @@ -507,7 +507,7 @@ function enable_rrd_graphing() { unset($rrdcreate); } - if($g['booting']) { + if(platform_booting()) { $rrdqcommand = "-t "; $rrducommand = "N"; $qi = 0; @@ -575,7 +575,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(platform_booting()) { mwexec("$rrdtool update $rrddbpath$ifname$cellular N:U:U:U"); } @@ -609,7 +609,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(platform_booting()) { mwexec("$rrdtool update $rrddbpath$ifname$states N:U:U:U:U:U"); } @@ -644,7 +644,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(platform_booting()) { mwexec("$rrdtool update $rrddbpath$ifname$proc N:U:U:U:U:U"); } @@ -682,7 +682,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(platform_booting()) { mwexec("$rrdtool update $rrddbpath$ifname$mem N:U:U:U:U:U"); } @@ -719,7 +719,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(platform_booting()) { mwexec("$rrdtool update $rrddbpath$ifname$mbuf N:U:U:U:U"); } @@ -796,7 +796,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(platform_booting()) { mwexec("$rrdtool update $concurrent_filename N:U"); } @@ -832,7 +832,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(platform_booting()) { mwexec("$rrdtool update $loggedin_filename N:U"); } @@ -875,7 +875,7 @@ function enable_rrd_graphing() { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(platform_booting()) { mwexec("$rrdtool update $rrddbpath$ntpd N:U:U:U:U:U:U"); } @@ -922,7 +922,7 @@ function enable_rrd_graphing() { chown($database, "nobody"); } - if($g['booting']) + if(platform_booting()) echo gettext("done.") . "\n"; } @@ -949,7 +949,7 @@ function create_gateway_quality_rrd($rrd_file) { } /* enter UNKNOWN values in the RRD so it knows we rebooted. */ - if($g['booting']) { + if(platform_booting()) { mwexec("$rrdtool update $rrd_file N:U:U"); } unset($rrdtool, $rrdinterval, $valid, $rrd_file); diff --git a/etc/inc/services.inc b/etc/inc/services.inc index b8a99ae..72183c2 100644 --- a/etc/inc/services.inc +++ b/etc/inc/services.inc @@ -281,7 +281,7 @@ function services_radvd_configure($blacklist = array()) { /* write radvd.conf */ if (!@file_put_contents("{$g['varetc_path']}/radvd.conf", $radvdconf)) { log_error("Error: cannot open radvd.conf in services_radvd_configure().\n"); - if ($g['booting']) + if (platform_booting()) printf("Error: cannot open radvd.conf in services_radvd_configure().\n"); } unset($radvdconf); @@ -367,7 +367,7 @@ function services_dhcpdv4_configure() { break; } - if ($g['booting']) { + if (platform_booting()) { /* restore the leases, if we have them */ if (file_exists("{$g['cf_conf_path']}/dhcpleases.tgz")) { $dhcprestore = ""; @@ -400,7 +400,7 @@ function services_dhcpdv4_configure() { } } - if ($g['booting']) + if (platform_booting()) echo gettext("Starting DHCP service..."); else sleep(1); @@ -913,7 +913,7 @@ EOD; join(" ", $dhcpdifs)); } - if ($g['booting']) + if (platform_booting()) print "done.\n"; return 0; @@ -1003,7 +1003,7 @@ function services_dhcpdv6_configure($blacklist = array()) { if (!is_dhcpv6_server_enabled()) return 0; - if ($g['booting']) { + if (platform_booting()) { if ($g['platform'] != "pfSense") { /* restore the leases, if we have them */ if (file_exists("{$g['cf_conf_path']}/dhcp6leases.tgz")) { @@ -1026,7 +1026,7 @@ function services_dhcpdv6_configure($blacklist = array()) { $Iflist = array_merge($Iflist, get_configured_pppoe_server_interfaces()); - if ($g['booting']) + if (platform_booting()) echo "Starting DHCPv6 service..."; else sleep(1); @@ -1303,7 +1303,7 @@ EOD; /* write dhcpdv6.conf */ if (!@file_put_contents("{$g['dhcpd_chroot_path']}/etc/dhcpdv6.conf", $dhcpdv6conf)) { log_error("Error: cannot open {$g['dhcpd_chroot_path']}/etc/dhcpdv6.conf in services_dhcpdv6_configure().\n"); - if ($g['booting']) + if (platform_booting()) printf("Error: cannot open {$g['dhcpd_chroot_path']}/etc/dhcpdv6.conf in services_dhcpdv6_configure().\n"); unset($dhcpdv6conf); return 1; @@ -1324,7 +1324,7 @@ EOD; join(" ", $dhcpdv6ifs)); mwexec("/usr/local/sbin/dhcpleases6 -c \"/usr/local/bin/php -f /usr/local/sbin/prefixes.php|/bin/sh\" -l {$g['dhcpd_chroot_path']}/var/db/dhcpd6.leases"); } - if ($g['booting']) + if (platform_booting()) print gettext("done.") . "\n"; return 0; @@ -1406,7 +1406,7 @@ function services_dhcrelay_configure() { if (!isset($dhcrelaycfg['enable'])) return 0; - if ($g['booting']) + if (platform_booting()) echo gettext("Starting DHCP relay service..."); else sleep(1); @@ -1528,7 +1528,7 @@ function services_dhcrelay6_configure() { if (!isset($dhcrelaycfg['enable'])) return 0; - if ($g['booting']) + if (platform_booting()) echo gettext("Starting DHCPv6 relay service..."); else sleep(1); @@ -1669,7 +1669,7 @@ function services_dyndns_configure($int = "") { $dyndnscfg = $config['dyndnses']['dyndns']; $gwgroups = return_gateway_groups_array(); if (is_array($dyndnscfg)) { - if ($g['booting']) + if (platform_booting()) echo gettext("Starting DynDNS clients..."); foreach ($dyndnscfg as $dyndns) { @@ -1682,7 +1682,7 @@ function services_dyndns_configure($int = "") { } } - if ($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; } @@ -1738,7 +1738,7 @@ function services_dnsmasq_configure() { if (isset($config['dnsmasq']['enable'])) { - if ($g['booting']) + if (platform_booting()) echo gettext("Starting DNS forwarder..."); else sleep(1); @@ -1866,11 +1866,11 @@ function services_dnsmasq_configure() { system_dhcpleases_configure(); - if ($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; } - if (!$g['booting']) { + if (!platform_booting()) { if(services_dhcpd_configure()!=0) $return = 1; } @@ -1892,7 +1892,7 @@ function services_unbound_configure() { sigkillbypid("{$g['varrun_path']}/unbound.pid", "TERM"); if (isset($config['unbound']['enable'])) { - if ($g['booting']) + if (platform_booting()) echo gettext("Starting DNS Resolver..."); else sleep(1); @@ -1903,13 +1903,13 @@ function services_unbound_configure() { require_once('/etc/inc/unbound.inc'); sync_unbound_service(); - if ($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; system_dhcpleases_configure(); } - if (!$g['booting']) { + if (!platform_booting()) { if (services_dhcpd_configure()!=0) $return = 1; } @@ -1932,7 +1932,7 @@ function services_snmpd_configure() { if (isset($config['snmpd']['enable'])) { - if ($g['booting']) + if (platform_booting()) echo gettext("Starting SNMP daemon... "); /* generate snmpd.conf */ @@ -2114,7 +2114,7 @@ EOD; mwexec("/usr/sbin/bsnmpd -c {$g['varetc_path']}/snmpd.conf" . "{$bindlan} -p {$g['varrun_path']}/snmpd.pid"); - if ($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; } diff --git a/etc/inc/system.inc b/etc/inc/system.inc index 871b7ca..137987b 100644 --- a/etc/inc/system.inc +++ b/etc/inc/system.inc @@ -184,7 +184,7 @@ function system_resolvconf_generate($dynupdate = false) { fwrite($fd, $resolvconf); fclose($fd); - if (!$g['booting']) { + if (!platform_booting()) { /* restart dhcpd (nameservers may have changed) */ if (!$dynupdate) services_dhcpd_configure(); @@ -714,7 +714,7 @@ function system_syslogd_start() { $syslogcfg = $config['syslog']; - if ($g['booting']) + if (platform_booting()) echo gettext("Starting syslog..."); if (is_process_running("fifolog_writer")) @@ -894,7 +894,7 @@ EOD; else $retval = mwexec_bg("/usr/sbin/syslogd -s -c -c -l {$g['dhcpd_chroot_path']}/var/run/log -P {$g['varrun_path']}/syslog.pid {$syslogd_extra}"); - if ($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; return $retval; @@ -941,7 +941,7 @@ function system_webgui_create_certificate() { function system_webgui_start() { global $config, $g; - if ($g['booting']) + if (platform_booting()) echo gettext("Starting webConfigurator..."); chdir($g['www_path']); @@ -984,7 +984,7 @@ function system_webgui_start() { /* attempt to start lighthttpd */ $res = mwexec("/usr/local/sbin/lighttpd -f {$g['varetc_path']}/lighty-webConfigurator.conf"); - if ($g['booting']) { + if (platform_booting()) { if ($res == 0) echo gettext("done.") . "\n"; else @@ -1379,7 +1379,7 @@ function system_timezone_configure() { $syscfg = $config['system']; - if ($g['booting']) + if (platform_booting()) echo gettext("Setting timezone..."); /* extract appropriate timezone file */ @@ -1405,7 +1405,7 @@ function system_timezone_configure() { mwexec("sync"); conf_mount_ro(); - if ($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; } @@ -1760,7 +1760,7 @@ function system_ntp_configure($start_ntpd=true) { function sync_system_time() { global $config, $g; - if ($g['booting']) + if (platform_booting()) echo gettext("Syncing system time before startup..."); /* foreach through servers and write out to ntpd.conf */ @@ -1768,7 +1768,7 @@ function sync_system_time() { mwexec("/usr/local/sbin/ntpdate -s $ts"); } - if ($g['booting']) + if (platform_booting()) echo gettext("done.") . "\n"; } @@ -1896,7 +1896,7 @@ function system_set_harddisk_standby() { } if (isset($config['system']['harddiskstandby'])) { - if ($g['booting']) { + if (platform_booting()) { echo gettext('Setting hard disk standby... '); } @@ -1908,13 +1908,13 @@ function system_set_harddisk_standby() { if (set_single_sysctl('hw.ata.standby', (int)$standby)) { // Reinitialize ATA-drives mwexec('/usr/local/sbin/atareinit'); - if ($g['booting']) { + if (platform_booting()) { echo gettext("done.") . "\n"; } - } else if ($g['booting']) { + } else if (platform_booting()) { echo gettext("failed!") . "\n"; } - } else if ($g['booting']) { + } else if (platform_booting()) { echo gettext("failed!") . "\n"; } } diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 83dcb5b..19e4363 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -2021,7 +2021,7 @@ function upgrade_054_to_055() { $xmldump = "{$database}.old.xml"; $xmldumpnew = "{$database}.new.xml"; - if ($g['booting']) + if (platform_booting()) echo "Migrate RRD database {$database} to new format for IPv6 \n"; mwexec("$rrdtool tune {$rrddbpath}{$database} -r roundtrip:delay 2>&1"); @@ -2057,7 +2057,7 @@ function upgrade_054_to_055() { $xmldumptmp = "{$database}.tmp.xml"; $xmldumpnew = "{$database}.new.xml"; - if ($g['booting']) + if (platform_booting()) echo "Migrate RRD database {$database} to new format \n"; /* rename DS source */ mwexec("$rrdtool tune {$rrddbpath}/{$database} -r in:inpass 2>&1"); @@ -2111,7 +2111,7 @@ function upgrade_054_to_055() { /* The function will restore the rrd.tgz so we will save it after */ exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='{$g['cf_conf_path']}' /etc/rc.backup_rrd.sh"); unlink_if_exists("{$g['vardb_path']}/rrd/*.xml"); - if ($g['booting']) + if (platform_booting()) echo "Updating configuration..."; } @@ -2676,7 +2676,7 @@ function upgrade_080_to_081() { $xmldump = "{$database}.old.xml"; $xmldumpnew = "{$database}.new.xml"; - if ($g['booting']) + if (platform_booting()) echo "Migrate RRD database {$database} to new format for IPv6.\n"; /* dump contents to xml and move database out of the way */ @@ -2796,7 +2796,7 @@ function upgrade_080_to_081() { /* Let's save the RRD graphs after we run enable RRD graphing */ /* The function will restore the rrd.tgz so we will save it after */ exec("cd /; LANG=C NO_REMOUNT=1 RRDDBPATH='{$rrddbpath}' CF_CONF_PATH='{$g['cf_conf_path']}' /etc/rc.backup_rrd.sh"); - if ($g['booting']) + if (platform_booting()) echo "Updating configuration..."; foreach($config['filter']['rule'] as & $rule) { if (isset($rule['protocol']) && !empty($rule['protocol'])) @@ -3119,7 +3119,7 @@ function upgrade_095_to_096() { $databases = return_dir_as_array($rrddbpath, '/-(traffic|packets)\.rrd$/'); rsort($databases); foreach($databases as $database) { - if ($g['booting']) + if (platform_booting()) echo "Update RRD database {$database}.\n"; $cmd = "{$rrdtool} tune {$rrddbpath}/{$database}"; diff --git a/etc/inc/voucher.inc b/etc/inc/voucher.inc index 56329df..1a79a4e 100644 --- a/etc/inc/voucher.inc +++ b/etc/inc/voucher.inc @@ -492,11 +492,11 @@ function voucher_configure($sync = false) { if (is_array($config['voucher'])) { foreach ($config['voucher'] as $voucherzone => $vcfg) { - if ($g['booting']) + if (platform_booting()) echo gettext("Enabling voucher support... "); $cpzone = $voucherzone; $error = voucher_configure_zone($sync); - if ($g['booting']) { + if (platform_booting()) { if ($error) echo "error\n"; else @@ -541,7 +541,7 @@ function voucher_configure_zone($sync = false) { @chmod("{$g['varetc_path']}/voucher_{$cpzone}.cfg", 0600); unlock($voucherlck); - if (($g['booting'] || $sync == true) && is_array($config['voucher'][$cpzone]['roll'])) { + if ((platform_booting() || $sync == true) && is_array($config['voucher'][$cpzone]['roll'])) { $voucherlck = lock("voucher{$cpzone}", LOCK_EX); diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc index 61d28df..5b018b7 100644 --- a/etc/inc/vpn.inc +++ b/etc/inc/vpn.inc @@ -157,7 +157,7 @@ function vpn_ipsec_configure($ipchg = false) mkdir("{$g['varetc_path']}/ipsec/ipsec.d/reqs"); - if ($g['booting']) + if (platform_booting()) echo gettext("Configuring IPsec VPN... "); /* fastforwarding is not compatible with ipsec tunnels */ @@ -198,7 +198,7 @@ function vpn_ipsec_configure($ipchg = false) if (!is_ipaddr($rg)) { $filterdns_list[] = "{$rg}"; add_hostname_to_watch($rg); - if(! $g['booting']) + if (!platform_booting()) $rg = resolve_retry($rg); if (!is_ipaddr($rg)) continue; @@ -881,7 +881,7 @@ EOD; @unlink("{$g['varrun_path']}/filterdns-ipsec.pid"); } - if ($g['booting']) + if (platform_booting()) echo "done\n"; return count($filterdns_list); @@ -953,7 +953,7 @@ function vpn_pptpd_configure() { $syscfg = $config['system']; $pptpdcfg = $config['pptpd']; - if ($g['booting']) { + if (platform_booting()) { if (!$pptpdcfg['mode'] || ($pptpdcfg['mode'] == "off")) return 0; @@ -1164,7 +1164,7 @@ EOD; break; } - if ($g['booting']) + if (platform_booting()) echo "done\n"; return 0; @@ -1188,7 +1188,7 @@ function vpn_pppoe_configure(&$pppoecfg) { if (!is_dir("{$g['varetc_path']}/pppoe{$pppoecfg['pppoeid']}-vpn")) mkdir("{$g['varetc_path']}/pppoe{$pppoecfg['pppoeid']}-vpn"); - if ($g['booting']) { + if (platform_booting()) { if (!$pppoecfg['mode'] || ($pppoecfg['mode'] == "off")) return 0; @@ -1384,7 +1384,7 @@ EOD; break; } - if ($g['booting']) + if (platform_booting()) echo gettext("done") . "\n"; return 0; @@ -1400,7 +1400,7 @@ function vpn_l2tp_configure() { if (!is_dir("{$g['varetc_path']}/l2tp-vpn")) mkdir("{$g['varetc_path']}/l2tp-vpn"); - if ($g['booting']) { + if (platform_booting()) { if (!$l2tpcfg['mode'] || ($l2tpcfg['mode'] == "off")) return 0; @@ -1581,7 +1581,7 @@ EOD; break; } - if ($g['booting']) + if (platform_booting()) echo "done\n"; return 0; diff --git a/etc/rc.filter_synchronize b/etc/rc.filter_synchronize index 38c34b3..cb6e499 100755 --- a/etc/rc.filter_synchronize +++ b/etc/rc.filter_synchronize @@ -90,7 +90,7 @@ function remove_special_characters($string) { function carp_check_version($url, $username, $password, $port = 80, $method = 'pfsense.host_firmware_version') { global $config, $g; - if(file_exists("{$g['varrun_path']}/booting") || $g['booting']) + if(file_exists("{$g['varrun_path']}/booting") || platform_booting()) return; $params = array( @@ -140,7 +140,7 @@ function carp_check_version($url, $username, $password, $port = 80, $method = 'p function carp_sync_xml($url, $username, $password, $sections, $port = 80, $method = 'pfsense.restore_config_section') { global $config, $g; - if(file_exists("{$g['varrun_path']}/booting") || $g['booting']) + if(file_exists("{$g['varrun_path']}/booting") || platform_booting()) return; update_filter_reload_status("Syncing CARP data to {$url}"); @@ -271,8 +271,7 @@ function carp_sync_xml($url, $username, $password, $sections, $port = 80, $metho } } -global $g; -if (file_exists("{$g['varrun_path']}/booting") || $g['booting']) +if (platform_booting()) return; if (is_array($config['hasync'])) { diff --git a/etc/rc.kill_states b/etc/rc.kill_states index 5db8892..f0b740c 100755 --- a/etc/rc.kill_states +++ b/etc/rc.kill_states @@ -34,8 +34,8 @@ require_once("interfaces.inc"); require_once("util.inc"); // Do not process while booting -if($g['booting']) - exit; +if (platform_booting()) + return; /* Interface address to cleanup states */ $interface = str_replace("\n", "", $argv[1]); diff --git a/etc/rc.linkup b/etc/rc.linkup index 29d3c5c..395486a 100755 --- a/etc/rc.linkup +++ b/etc/rc.linkup @@ -94,8 +94,7 @@ function handle_argument_group($iface, $argument2) { } } -global $g; -if (!file_exists("{$g['varrun_path']}/booting") && empty($g['booting'])) { +if (platform_booting()) { if (isset($_GET['interface'])) { if (!empty($_GET['interface'])) handle_argument_group(convert_real_interface_to_friendly_interface_name($_GET['interface']), $_GET['action']); diff --git a/etc/rc.newwanip b/etc/rc.newwanip index b42119c..a7db7d1 100755 --- a/etc/rc.newwanip +++ b/etc/rc.newwanip @@ -44,7 +44,7 @@ require_once("IPv6.inc"); require_once("rrd.inc"); // Do not process while booting -if($g['booting']) +if (platform_booting()) return; function restart_packages() { diff --git a/etc/rc.newwanipv6 b/etc/rc.newwanipv6 index 5b9ff86..c390234 100755 --- a/etc/rc.newwanipv6 +++ b/etc/rc.newwanipv6 @@ -81,7 +81,7 @@ if (empty($interface)) { } //Do not process while booting -if ($g['booting'] && $config['interfaces'][$interface]['ipaddrv6'] != "dhcp6") +if (platform_booting() && $config['interfaces'][$interface]['ipaddrv6'] != "dhcp6") return; /* |