summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-07-31 10:03:34 -0300
committerRenato Botelho <renato@netgate.com>2015-07-31 10:03:34 -0300
commit5779ade6707ba530517da239d9ec3fc751d17d83 (patch)
tree9295a06ae80c1dd54611e7c279c42e3e242a6790 /etc
parent6fed300c6ae8c5bcac03f867daf737e2676dcc30 (diff)
downloadpfsense-5779ade6707ba530517da239d9ec3fc751d17d83.zip
pfsense-5779ade6707ba530517da239d9ec3fc751d17d83.tar.gz
Introduce a new item to $g global, 'product_version' and stop reading /etc/version all around
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/globals.inc4
-rw-r--r--etc/inc/pfsense-utils.inc12
-rw-r--r--etc/inc/services.inc3
-rwxr-xr-xetc/rc.banner3
4 files changed, 10 insertions, 12 deletions
diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc
index 504f67c..b40a862 100644
--- a/etc/inc/globals.inc
+++ b/etc/inc/globals.inc
@@ -58,6 +58,7 @@ $g = array(
"xml_rootobj" => "pfsense",
"admin_group" => "admins",
"product_name" => "pfSense",
+ "product_version" => trim(file_get_contents("{$g['etc_path']}/version"), " \n"),
"product_copyright" => "Electric Sheep Fencing LLC",
"product_copyright_url" => "http://www.electricsheepfencing.com",
"product_copyright_years" => "2004 - ".date("Y"),
@@ -98,9 +99,8 @@ $tcpflags = array("syn", "ack", "fin", "rst", "psh", "urg", "ece", "cwr");
if (file_exists("/etc/platform")) {
$arch = php_uname("m");
- $current_version = trim(file_get_contents("{$g['etc_path']}/version"));
- if (strstr($current_version, "-RELEASE")) {
+ if (strstr($g['product_version'], "-RELEASE")) {
/* This is only necessary for RELEASE */
$arch = ($arch == "i386") ? "" : '/' . $arch;
/* Full installs and NanoBSD use the same update directory and manifest in 2.x */
diff --git a/etc/inc/pfsense-utils.inc b/etc/inc/pfsense-utils.inc
index 22b0be0..93719ad 100644
--- a/etc/inc/pfsense-utils.inc
+++ b/etc/inc/pfsense-utils.inc
@@ -802,7 +802,7 @@ function check_firmware_version($tocheck = "all", $return_php = true) {
}
$version = php_uname('r');
$version = explode('-', $version);
- $rawparams = array("firmware" => array("version" => trim(file_get_contents('/etc/version'))),
+ $rawparams = array("firmware" => array("version" => $g['product_version']),
"kernel" => array("version" => $version[0]),
"base" => array("version" => $version[0]),
"platform" => trim(file_get_contents('/etc/platform')),
@@ -841,7 +841,7 @@ function host_firmware_version($tocheck = "") {
$os_version = trim(substr(php_uname("r"), 0, strpos(php_uname("r"), '-')));
return array(
- "firmware" => array("version" => trim(file_get_contents('/etc/version', " \n"))),
+ "firmware" => array("version" => $g['product_version']),
"kernel" => array("version" => $os_version),
"base" => array("version" => $os_version),
"platform" => trim(file_get_contents('/etc/platform', " \n")),
@@ -1773,9 +1773,9 @@ function download_file($url, $destination, $verify_ssl = true, $connect_timeout
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
if (!isset($config['system']['host_uuid'])) {
- curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version") . ' : ' . get_single_sysctl('kern.hostuuid')));
+ curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . $g['product_version'] . ' : ' . get_single_sysctl('kern.hostuuid'));
} else {
- curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version")));
+ curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . $g['product_version']);
}
if (!empty($config['system']['proxyurl'])) {
@@ -1819,9 +1819,9 @@ function download_file_with_progress_bar($url_file, $destination_file, $readbody
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $connect_timeout);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
if (!isset($config['system']['host_uuid'])) {
- curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version") . ' : ' . get_single_sysctl('kern.hostuuid')));
+ curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . $g['product_version'] . ' : ' . get_single_sysctl('kern.hostuuid'));
} else {
- curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . rtrim(file_get_contents("/etc/version")));
+ curl_setopt($ch, CURLOPT_USERAGENT, $g['product_name'] . '/' . $g['product_version']);
}
if (!empty($config['system']['proxyurl'])) {
diff --git a/etc/inc/services.inc b/etc/inc/services.inc
index e3bf092..1412f7e 100644
--- a/etc/inc/services.inc
+++ b/etc/inc/services.inc
@@ -2084,13 +2084,12 @@ trap := "{$config['snmpd']['trapstring']}"
EOD;
}
- $version = trim(file_get_contents('/etc/version'));
$platform = trim(file_get_contents('/etc/platform'));
if (($platform == "pfSense") && ($g['product_name'] != "pfSense")) {
$platform = $g['product_name'];
}
$sysDescr = "{$g['product_name']} " . php_uname("n") .
- " {$version} {$platform} " . php_uname("s") .
+ " {$g['product_version']} {$platform} " . php_uname("s") .
" " . php_uname("r") . " " . php_uname("m");
$snmpdconf .= <<<EOD
diff --git a/etc/rc.banner b/etc/rc.banner
index 768a70d..e31d474 100755
--- a/etc/rc.banner
+++ b/etc/rc.banner
@@ -36,7 +36,6 @@
require_once("gwlb.inc");
require_once("interfaces.inc");
- $version = trim(file_get_contents("{$g['etc_path']}/version"));
$platform = trim(file_get_contents("{$g['etc_path']}/platform"));
$hostname = $config['system']['hostname'];
$product = $g['product_name'];
@@ -47,7 +46,7 @@
$platformbanner = "-{$platform}";
}
- print "*** Welcome to {$product} {$version}{$platformbanner} ({$machine}) on {$hostname} ***\n";
+ print "*** Welcome to {$product} {$g['product_version']}{$platformbanner} ({$machine}) on {$hostname} ***\n";
$iflist = get_configured_interface_with_descr(false, true);
foreach ($iflist as $ifname => $friendly) {
OpenPOWER on IntegriCloud