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 /etc/inc/config.inc | |
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
Diffstat (limited to 'etc/inc/config.inc')
-rw-r--r-- | etc/inc/config.inc | 43 |
1 files changed, 19 insertions, 24 deletions
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 */ |