summaryrefslogtreecommitdiffstats
path: root/src/etc
diff options
context:
space:
mode:
Diffstat (limited to 'src/etc')
-rw-r--r--src/etc/inc/authgui.inc86
-rw-r--r--src/etc/inc/config.lib.inc45
-rw-r--r--src/etc/inc/globals.inc6
-rw-r--r--src/etc/inc/gwlb.inc8
-rw-r--r--src/etc/inc/interfaces.inc5
-rw-r--r--src/etc/inc/pfsense-utils.inc11
-rw-r--r--src/etc/inc/pkg-utils.inc36
-rw-r--r--src/etc/inc/system.inc7
-rw-r--r--src/etc/inc/upgrade_config.inc62
-rw-r--r--src/etc/inc/vpn.inc8
-rwxr-xr-xsrc/etc/pfSense-rc3
-rw-r--r--src/etc/pfSense.obsoletedfiles1
-rwxr-xr-xsrc/etc/rc.update_pkg_metadata48
13 files changed, 258 insertions, 68 deletions
diff --git a/src/etc/inc/authgui.inc b/src/etc/inc/authgui.inc
index 9fa6e1b..934ff41 100644
--- a/src/etc/inc/authgui.inc
+++ b/src/etc/inc/authgui.inc
@@ -106,33 +106,77 @@ function display_error_form($http_code, $desc) {
return;
}
- $cssfile = "/css/pfSense.css";
-
- if (isset($user_settings['webgui']['webguicss'])) {
- if (file_exists("/usr/local/www/css/" . $user_settings['webgui']['webguicss'])) {
- $cssfile = "/css/" . $user_settings['webgui']['webguicss'];
- }
- }
-
+ $logincssfile = "#770101";
?>
+
<!DOCTYPE html>
<html lang="en">
-<head>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet" href="<?=$cssfile?>" />
- <title><?=gettext("Error: not allowed"); ?></title>
-</head>
-<body id="error" class="no-menu">
- <div id="jumbotron">
- <div class="container">
- <div class="col-sm-offset-3 col-sm-6 col-xs-12">
- <!-- FIXME: We really need to POST the logout action -->
- <div class="alert alert-danger" role="alert"><a href="index.php?logout"><?=$desc;?></a></div>
+ <head>
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="stylesheet" href="/vendor/bootstrap/css/bootstrap.min.css" type="text/css">
+ <link rel="stylesheet" href="/css/login.css" type="text/css">
+ <title><?=gettext("Error"); ?></title>
+ </head>
+
+ <body id="error" >
+ <div id="total">
+ <header>
+ <div id="headerrow">
+ <div class="row">
+ <div class="col-sm-4">
+ <div id="logodiv" style="text-align:center" class="nowarning">
+ <svg role="img" aria-labelledby="pfsense-logo" x="0px" y="0px" viewBox="0 0 282.8 84.2" width="240" height="100%">
+ <title id="pfsense-logo-svg">pfSense Logo</title>
+ <style type="text/css">
+ .logo-st0{fill:#2B40B5;}
+ .logo-st1{fill:#1475CF;}
+ .logo-st2{fill:#1C1275;}
+ </style>
+ <path class="logo-st0" d="M27.8,57.7c2.9,0,5.4-0.9,7.5-2.6c2.1-1.7,3.6-4,4.4-6.8c0.8-2.8,0.6-5.1-0.5-6.8c-1.1-1.7-3.2-2.6-6.1-2.6 c-2.9,0-5.4,0.9-7.5,2.6c-2.1,1.7-3.5,4-4.3,6.8c-0.8,2.8-0.7,5.1,0.5,6.8C22.8,56.9,24.8,57.7,27.8,57.7"/>
+ <path class="logo-st0" d="M115.1,46.6c-1.5-0.8-3-1.4-4.7-1.8c-1.7-0.4-3.2-0.7-4.7-1.1c-1.5-0.3-2.7-0.7-3.6-1.1c-0.9-0.4-1.4-1.1-1.4-2 c0-1.1,0.5-1.9,1.4-2.4c0.9-0.5,1.9-0.7,2.8-0.7c2.8,0,5,1,6.7,3.1l7-7c-1.7-1.8-3.9-3.1-6.4-3.8c-2.5-0.7-5-1.1-7.4-1.1 c-1.9,0-3.9,0.2-5.7,0.7c-1.9,0.5-3.6,1.2-5,2.3c-1.5,1-2.6,2.3-3.5,3.9c-0.9,1.6-1.3,3.5-1.3,5.7c0,2.3,0.5,4.2,1.4,5.6 c0.9,1.4,2.1,2.5,3.6,3.3c1.5,0.8,3,1.3,4.7,1.7c1.7,0.4,3.2,0.7,4.7,1.1c1.5,0.3,2.7,0.7,3.6,1.2c0.9,0.5,1.4,1.2,1.4,2.2 c0,1-0.5,1.7-1.6,2.1c-1.1,0.4-2.3,0.6-3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8-1.1-1.1C279.6,65.8,279.1,65.7,278.6,65.7z M278.6,65.1c0.6,0,1.2,0.2,1.8,0.5c0.6,0.3,1,0.7,1.3,1.3c0.3,0.6,0.5,1.2,0.5,1.8c0,0.6-0.2,1.2-0.5,1.8c-0.3,0.6-0.8,1-1.3,1.3 c-0.6,0.3-1.2,0.5-1.8,0.5c-0.6,0-1.2-0.2-1.8-0.5c-0.6-0.3-1-0.8-1.3-1.3c-0.3-0.6-0.5-1.2-0.5-1.8c0-0.6,0.2-1.2,0.5-1.8 c0.3-0.6,0.8-1,1.3-1.3C277.4,65.2,278,65.1,278.6,65.1z"/>
+ </svg>
+ </div>
+ </div>
+ <div class="col-sm-8 nowarning msgbox text-center">
+ <span id="hostspan">
+ </span>
+ </div>
+ </div>
+ </div>
+ </header>
+
+ <div style="background: <?=$logincssfile?>;" class="pagebody">
+ <div class="col-sm-2"></div>
+
+ <div class="col-sm-8 offset-md-4 logoCol">
+ <div class="loginCont center-block error-panel">
+ <a href="index.php?logout"><?=$desc;?></a>
+ </div>
+ </div>
+
+ <div class="col-sm-2"></div>
</div>
+
+ <footer id="3">
+ <div id="footertext">
+ <p class="text-muted">
+ <a target="_blank" href="https://www.pfsense.org/?gui=bootstrap">pfSense</a> is &copy;
+ 2004 - 2017 by <a href="https://pfsense.org/license" class="tblnk">Rubicon Communications, LLC (Netgate)</a>. All Rights Reserved.
+ [<a href="/license.php" class="tblnk">view license</a>]
+ </p>
+ </div>
+ </footer>
</div>
- </div>
-</body>
+ </body>
</html>
+
<?php
} // end function
diff --git a/src/etc/inc/config.lib.inc b/src/etc/inc/config.lib.inc
index 0ee64b9..988c9b8 100644
--- a/src/etc/inc/config.lib.inc
+++ b/src/etc/inc/config.lib.inc
@@ -337,9 +337,6 @@ function convert_config() {
}
}
}
- if ($config['version'] == $g['latest_config']) {
- return; /* already at latest version */
- }
// Save off config version
$prev_version = $config['version'];
@@ -349,17 +346,37 @@ function convert_config() {
if (file_exists("/etc/inc/upgrade_config_custom.inc")) {
include_once("upgrade_config_custom.inc");
}
+
+ if ($config['version'] == $g['latest_config']) {
+ additional_config_upgrade();
+ return; /* already at latest version */
+ }
+
+ if (!is_array($config['system']['already_run_config_upgrade'])) {
+ $config['system']['already_run_config_upgrade'] = array();
+ }
+ $already_run = $config['system']['already_run_config_upgrade'];
+
/* Loop and run upgrade_VER_to_VER() until we're at current version */
while ($config['version'] < $g['latest_config']) {
$cur = $config['version'] * 10;
$next = $cur + 1;
- $migration_function = sprintf('upgrade_%03d_to_%03d', $cur, $next);
- if (function_exists($migration_function)) {
- $migration_function();
- }
- $migration_function = "{$migration_function}_custom";
- if (function_exists($migration_function)) {
- $migration_function();
+ $migration_function = sprintf('upgrade_%03d_to_%03d', $cur,
+ $next);
+
+ foreach (array("", "_custom") as $suffix) {
+ $migration_function .= $suffix;
+ if (!function_exists($migration_function)) {
+ continue;
+ }
+ if (isset($already_run[$migration_function])) {
+ /* Already executed, skip now */
+ unset($config['system']
+ ['already_run_config_upgrade']
+ [$migration_function]);
+ } else {
+ $migration_function();
+ }
}
$config['version'] = sprintf('%.1f', $next / 10);
if (platform_booting()) {
@@ -367,12 +384,14 @@ function convert_config() {
}
}
- $now = date("H:i:s");
- log_error(sprintf(gettext("Ended Configuration upgrade at %s"), $now));
-
if ($prev_version != $config['version']) {
+ $now = date("H:i:s");
+ log_error(sprintf(gettext("Ended Configuration upgrade at %s"), $now));
+
write_config(sprintf(gettext('Upgraded config version level from %1$s to %2$s'), $prev_version, $config['version']));
}
+
+ additional_config_upgrade();
}
/****f* config/safe_write_file
diff --git a/src/etc/inc/globals.inc b/src/etc/inc/globals.inc
index 071ab3f..dcc5819 100644
--- a/src/etc/inc/globals.inc
+++ b/src/etc/inc/globals.inc
@@ -71,7 +71,7 @@ $g = array(
"disablecrashreporter" => false,
"crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php",
"debug" => false,
- "latest_config" => "16.8",
+ "latest_config" => "16.9",
"minimum_ram_warning" => "101",
"minimum_ram_warning_text" => "128 MB",
"wan_interface_name" => "wan",
@@ -172,6 +172,10 @@ if (file_exists("/etc/inc/globals_override.inc")) {
/* Read all XML files in following dir and load menu entries */
$g["ext_menu_path"] = "/usr/local/share/{$g['product_name']}/menu";
+/* Cache file used to store pfSense version */
+$g["version_cache_file"] = "{$g['varrun_path']}/{$g['product_name']}_version";
+$g['version_cache_refresh'] = 2 * 60 * 60; /* 2h */
+
function platform_booting($on_console = false) {
global $g;
diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc
index 83c2592..97347ad 100644
--- a/src/etc/inc/gwlb.inc
+++ b/src/etc/inc/gwlb.inc
@@ -92,7 +92,7 @@ function start_dpinger($gateway) {
global $g;
if (!isset($gateway['gwifip'])) {
- return;
+ return (false);
}
$dpinger_defaults = return_dpinger_defaults();
@@ -166,8 +166,12 @@ function start_dpinger($gateway) {
/* Do not try to bind IPv6 where interface is in tentative state */
if (is_ipaddrv6($gateway['gwifip'])) {
- interface_wait_tentative(get_real_interface(
+ $err = interface_wait_tentative(get_real_interface(
$gateway['interface']));
+ if ($err == false) {
+ log_error(gettext("Timeout waiting for IPv6 address in tentative state. dpinger will not run."));
+ return (false);
+ }
}
/* Redirect stdout to /dev/null to avoid exec() to wait for dpinger */
diff --git a/src/etc/inc/interfaces.inc b/src/etc/inc/interfaces.inc
index c47a542..e711f91 100644
--- a/src/etc/inc/interfaces.inc
+++ b/src/etc/inc/interfaces.inc
@@ -3873,9 +3873,6 @@ function interface_6rd_configure($interface = "wan", $wancfg) {
/* XXX: need to extend to support variable prefix size for v4 */
- if (!is_module_loaded("if_stf")) {
- mwexec("/sbin/kldload if_stf.ko");
- }
$stfiface = "{$interface}_stf";
if (does_interface_exist($stfiface)) {
pfSense_interface_destroy($stfiface);
@@ -3883,7 +3880,7 @@ function interface_6rd_configure($interface = "wan", $wancfg) {
$tmpstfiface = pfSense_interface_create("stf");
pfSense_interface_rename($tmpstfiface, $stfiface);
pfSense_interface_flags($stfiface, IFF_LINK2);
- mwexec("/sbin/ifconfig {$stfiface} inet6 {$rd6prefix}/{$rd6prefixlen}");
+ mwexec("/sbin/ifconfig {$stfiface} inet6 no_dad {$rd6prefix}/{$rd6prefixlen}");
mwexec("/sbin/ifconfig {$stfiface} stfv4br " . escapeshellarg($wancfg['gateway-6rd']));
if ($wancfg['prefix-6rd-v4plen'] >= 0 && $wancfg['prefix-6rd-v4plen'] <= 32) {
mwexec("/sbin/ifconfig {$stfiface} stfv4net {$ip4address}/" . escapeshellarg($wancfg['prefix-6rd-v4plen']));
diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc
index 2c3ac9a..86342b5 100644
--- a/src/etc/inc/pfsense-utils.inc
+++ b/src/etc/inc/pfsense-utils.inc
@@ -2938,15 +2938,16 @@ function set_language() {
function get_locale_list() {
$locales = array(
"bs" => gettext("Bosnian"),
- "de_DE" => gettext("German (Germany)"),
+ "zh_Hans_CN" => gettext("Chinese (Simplified, China)"),
+ "zh_TW" => gettext("Chinese (Taiwan)"),
+ "nl" => gettext("Dutch"),
"en_US" => gettext("English"),
- "es" => gettext("Spanish"),
- "es_AR" => gettext("Spanish (Argentina)"),
+ "de_DE" => gettext("German (Germany)"),
"nb" => gettext("Norwegian Bokmål"),
"pt_BR" => gettext("Portuguese (Brazil)"),
"ru" => gettext("Russian"),
- "zh_Hans_CN" => gettext("Chinese (Simplified, China)"),
- "zh_TW" => gettext("Chinese (Taiwan)"),
+ "es" => gettext("Spanish"),
+ "es_AR" => gettext("Spanish (Argentina)"),
);
// If the locales are sorted, the order changes depending on the language selected. If the user accidentally
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc
index e342d94..6c6d12b 100644
--- a/src/etc/inc/pkg-utils.inc
+++ b/src/etc/inc/pkg-utils.inc
@@ -1170,14 +1170,34 @@ function get_base_pkg_name() {
}
/* Verify if system needs upgrade (meta package or base) */
-function get_system_pkg_version($baseonly = false) {
+function get_system_pkg_version($baseonly = false, $use_cache = true) {
global $g;
- $output = exec("/usr/local/sbin/{$g['product_name']}-upgrade -c", $_gc,
- $rc);
+ $cache_file = $g['version_cache_file'];
+ $rc_file = $cache_file . '.rc';
+
+ $rc = "";
+ if ($use_cache && file_exists($rc_file) &&
+ (time()-filemtime($rc_file) < $g['version_cache_refresh'])) {
+ $rc = chop(@file_get_contents($rc_file));
+ }
+
+ if ($rc == "2") {
+ $output = @file_get_contents($cache_file);
+ } else if ($rc != "0") {
+ $output = exec(
+ "/usr/local/sbin/{$g['product_name']}-upgrade -c", $_gc,
+ $rc);
+
+ /* Update cache if it succeeded */
+ if ($rc == 0 || $rc == 2) {
+ @file_put_contents($cache_file, $output);
+ @file_put_contents($rc_file, $rc);
+ }
+ }
/* pfSense-upgrade returns 2 when there is a new version */
- if ($rc == 2) {
+ if ($rc == "2") {
$new_version = explode(' ', $output)[0];
}
@@ -1188,7 +1208,7 @@ function get_system_pkg_version($baseonly = false) {
return false;
}
- $info = get_pkg_info($base_pkg, true);
+ $info = get_pkg_info($base_pkg, true, true);
$pkg_info = array();
foreach ($info as $item) {
@@ -1200,7 +1220,7 @@ function get_system_pkg_version($baseonly = false) {
if (empty($pkg_info) || (!$baseonly && ($pkg_info['version'] ==
$pkg_info['installed_version']))) {
- $info = get_pkg_info($meta_pkg, true);
+ $info = get_pkg_info($meta_pkg, true, true);
foreach ($info as $item) {
if ($item['name'] == $meta_pkg) {
@@ -1282,7 +1302,9 @@ function pkg_switch_repo($path) {
file_put_contents("/usr/local/etc/pkg.conf", $pkg_conf);
}
- return pkg_update(true);
+ /* Update pfSense_version cache */
+ mwexec_bg("/etc/rc.update_pkg_metadata now");
+ return;
}
?>
diff --git a/src/etc/inc/system.inc b/src/etc/inc/system.inc
index b6b1444..295641d 100644
--- a/src/etc/inc/system.inc
+++ b/src/etc/inc/system.inc
@@ -549,10 +549,11 @@ function system_hosts_generate() {
$hosts_array = system_hosts_entries($dnsmasqcfg);
foreach ($hosts_array as $host) {
$hosts .= "{$host['ipaddr']}\t";
- if (!empty($host['name'])) {
- $hosts .= "{$host['name']} ";
+ if ($host['name'] == "localhost") {
+ $hosts .= "{$host['name']} {$host['fqdn']}";
+ } else {
+ $hosts .= "{$host['fqdn']} {$host['name']}";
}
- $hosts .= "{$host['fqdn']}";
$hosts .= "\n";
}
unset($hosts_array);
diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc
index a8d5370..7a38554 100644
--- a/src/etc/inc/upgrade_config.inc
+++ b/src/etc/inc/upgrade_config.inc
@@ -5328,8 +5328,8 @@ function upgrade_165_to_166() {
function upgrade_166_to_167() {
global $config;
- if (strpos($config['widgets']['sequence'], 'netgate_services_and_support') === false) {
-
+ if (strpos($config['widgets']['sequence'],
+ 'netgate_services_and_support') === false) {
$widgets = explode(",", $config['widgets']['sequence']);
$cnt = count($widgets);
$col2 = $cnt;
@@ -5337,20 +5337,25 @@ function upgrade_166_to_167() {
// Locate the firt column 2 widget
for ($idx=0;$idx<$cnt;$idx++) {
- if (strpos($widgets[$idx], 'col2') !== false) {
- $col2 = $idx;
- break;
+ if (strpos($widgets[$idx], 'col2') !== false) {
+ $col2 = $idx;
+ break;
}
}
- // Loop through the widgets inserting the new widget before the first col2 widget
+ /*
+ * Loop through the widgets inserting the new widget before
+ * the first col2 widget
+ */
for ($old=0,$new=0;$old<$cnt;$old++,$new++) {
$newsequence[$new] = $widgets[$old];
- if ($old == ($col2 - 1)) {
- $new++;
- $newsequence[$new] = "netgate_services_and_support:col2:open:0";
+ if ($old != ($col2 - 1)) {
+ continue;
}
+ $new++;
+ $newsequence[$new] =
+ "netgate_services_and_support:col2:open:0";
}
$config['widgets']['sequence'] = implode(",", $newsequence);
@@ -5360,4 +5365,43 @@ function upgrade_166_to_167() {
function upgrade_167_to_168() {
upgrade_166_to_167();
}
+
+function upgrade_168_to_169() {
+ global $config;
+
+ /* Remove workaround added in 2.3 */
+ unset($config['cron']['rc_update_pkg_metadata']);
+
+ $command = '/usr/bin/nice -n20 /etc/rc.update_pkg_metadata';
+ if (is_array($config['cron']['item'])) {
+ foreach ($config['cron']['item'] as $entry) {
+ if ($entry['command'] == $command) {
+ return;
+ }
+ }
+ }
+
+ $config['cron']['item'][] = array(
+ 'minute' => '1',
+ 'hour' => '0',
+ 'mday' => '*',
+ 'month' => '*',
+ 'wday' => '*',
+ 'who' => 'root',
+ 'command' => $command
+ );
+}
+
+/*
+ * Special function that is called independent of current config version. It's
+ * a workaround to have config_upgrade running on older versions after next
+ * config version was already taken by newer pfSense.
+ *
+ * XXX Change the way we handle config version to make it based on product
+ * version
+ */
+function additional_config_upgrade() {
+ global $config;
+}
+
?>
diff --git a/src/etc/inc/vpn.inc b/src/etc/inc/vpn.inc
index 6390aed..8eb2c3c 100644
--- a/src/etc/inc/vpn.inc
+++ b/src/etc/inc/vpn.inc
@@ -862,7 +862,7 @@ EOD;
if (is_ipaddr($right_spec)) {
$sourcehost = $right_spec;
} else {
- $sourcehost = $rgmap['remote-gateway'];
+ $sourcehost = $rgmap[$right_spec];
}
if (substr($ph1ent['interface'], 0, 4) == "_vip") {
@@ -888,7 +888,8 @@ EOD;
$subnet_bits = get_interface_subnet($vpninterface);
$subnet_ip = gen_subnetv4($interfaceip, $subnet_bits);
/* if the remote gateway is in the local subnet, then don't add a route */
- if (!ip_in_subnet($sourcehost, "{$subnet_ip}/{$subnet_bits}")) {
+ if (is_ipaddrv4($sourcehost) &&
+ !ip_in_subnet($sourcehost, "{$subnet_ip}/{$subnet_bits}")) {
if (is_ipaddrv4($gatewayip)) {
// log_error("IPSEC interface is not WAN but {$ifacesuse}, adding static route for VPN endpoint {$rgip} via {$gatewayip}");
route_add_or_change("-host {$sourcehost} {$gatewayip}");
@@ -902,7 +903,8 @@ EOD;
$subnet_bits = get_interface_subnetv6($vpninterface);
$subnet_ip = gen_subnetv6($interfaceip, $subnet_bits);
/* if the remote gateway is in the local subnet, then don't add a route */
- if (!ip_in_subnet($sourcehost, "{$subnet_ip}/{$subnet_bits}")) {
+ if (is_ipaddrv6($sourcehost) &&
+ !ip_in_subnet($sourcehost, "{$subnet_ip}/{$subnet_bits}")) {
if (is_ipaddrv6($gatewayip)) {
// log_error("IPSEC interface is not WAN but {$ifacesuse}, adding static route for VPN endpoint {$rgip} via {$gatewayip}");
route_add_or_change("-inet6 -host {$sourcehost} {$gatewayip}");
diff --git a/src/etc/pfSense-rc b/src/etc/pfSense-rc
index 0bb0f2b..31da47b 100755
--- a/src/etc/pfSense-rc
+++ b/src/etc/pfSense-rc
@@ -412,6 +412,9 @@ fi
/usr/local/sbin/${product}-upgrade -y -b 3
+# Update pkg metadata
+/etc/rc.update_pkg_metadata now
+
# Log product version to syslog
get_version
BUILDTIME=`cat /etc/version.buildtime`
diff --git a/src/etc/pfSense.obsoletedfiles b/src/etc/pfSense.obsoletedfiles
index 802c8ca..49ae203 100644
--- a/src/etc/pfSense.obsoletedfiles
+++ b/src/etc/pfSense.obsoletedfiles
@@ -1015,6 +1015,7 @@
/usr/local/www/vpn_pppoe_edit.php
/usr/local/www/vpn_pppoe_users.php
/usr/local/www/vpn_pppoe_users_edit.php
+/usr/local/www/widgets/include/thermal_sensors.inc
/usr/local/www/widgets/widgets/deactivated
/usr/local/www/widgets/widgets/support.widget.php
/usr/local/www/wizards/traffic_shaper_wizard.inc
diff --git a/src/etc/rc.update_pkg_metadata b/src/etc/rc.update_pkg_metadata
new file mode 100755
index 0000000..f22c1af
--- /dev/null
+++ b/src/etc/rc.update_pkg_metadata
@@ -0,0 +1,48 @@
+#!/bin/sh
+#
+# rc.update_pkg_metadata
+#
+# Copyright (c) 2017 Rubicon Communications, LLC (Netgate). All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+if [ "$1" = "now" ]; then
+ sleep_time=0
+else
+ sleep_time=$(jot -r 1 1 86399)
+fi
+
+# Read product_name from $g, defaults to pfSense
+product=$(/usr/local/sbin/read_global_var product_name pfSense)
+
+tmp_version=$(mktemp -q /tmp/${product}_version.XXXXXXXX) \
+ || exit 1
+
+( \
+ sleep $sleep_time \
+ && /usr/local/sbin/${product}-upgrade -uf \
+ && ( \
+ /usr/local/sbin/${product}-upgrade -Uc > ${tmp_version}.tmp \
+ ; rc=$? \
+ ; tail -n 1 ${tmp_version}.tmp > $tmp_version \
+ ; rm -f ${tmp_version}.tmp \
+ ; echo $rc > ${tmp_version}.rc \
+ ; test $rc -eq 2 && return 0 || return $rc \
+ ) \
+ && ( \
+ mv $tmp_version /var/run/${product}_version \
+ && mv ${tmp_version}.rc /var/run/${product}_version.rc \
+ ) || rm -f $tmp_version ${tmp_version}.rc
+) >/dev/null 2>&1 &
+
+exit 0
OpenPOWER on IntegriCloud