summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-02-14 08:26:31 -0200
committerRenato Botelho <renato@netgate.com>2017-02-14 08:27:03 -0200
commitf07da0aa488f38c245b4935ffd8910036dc47428 (patch)
treed70073332ce9ff24a6bba96b25a6f3aeed016b36 /src
parent4289b4c18726388316f13aba99d3ff6868874279 (diff)
downloadpfsense-f07da0aa488f38c245b4935ffd8910036dc47428.zip
pfsense-f07da0aa488f38c245b4935ffd8910036dc47428.tar.gz
Fix #7257: Use pfSense-upgrade to look for new versions
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/pkg-utils.inc22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc
index b7aa6f2..ef3e7b8 100644
--- a/src/etc/inc/pkg-utils.inc
+++ b/src/etc/inc/pkg-utils.inc
@@ -1173,6 +1173,14 @@ function get_base_pkg_name() {
function get_system_pkg_version($baseonly = false) {
global $g;
+ $output = exec("/usr/local/sbin/{$g['product_name']}-upgrade -c", $_gc,
+ $rc);
+
+ /* pfSense-upgrade returns 2 when there is a new version */
+ if ($rc == 2) {
+ $new_version = explode(' ', $output)[0];
+ }
+
$base_pkg = get_base_pkg_name();
$meta_pkg = get_meta_pkg_name();
@@ -1180,23 +1188,24 @@ function get_system_pkg_version($baseonly = false) {
return false;
}
- $info = get_pkg_info($base_pkg);
- $pkg_name = $base_pkg;
+ $info = get_pkg_info($base_pkg, true);
$pkg_info = array();
foreach ($info as $item) {
if ($item['name'] == $base_pkg) {
$pkg_info = $item;
+ break;
}
}
- if (empty($pkg_info) || (!$baseonly && ($pkg_info['version'] == $pkg_info['installed_version']))) {
- $info = get_pkg_info($meta_pkg);
- $pkg_name = $meta_pkg;
+ if (empty($pkg_info) || (!$baseonly && ($pkg_info['version'] ==
+ $pkg_info['installed_version']))) {
+ $info = get_pkg_info($meta_pkg, true);
foreach ($info as $item) {
if ($item['name'] == $meta_pkg) {
$pkg_info = $item;
+ break;
}
}
}
@@ -1206,8 +1215,7 @@ function get_system_pkg_version($baseonly = false) {
}
return array(
- 'pkg_name' => $pkg_name,
- 'version' => $pkg_info['version'],
+ 'version' => $new_version ?: $pkg_info['version'],
'installed_version' => $pkg_info['installed_version']
);
}
OpenPOWER on IntegriCloud