summaryrefslogtreecommitdiffstats
path: root/src/etc
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-10-20 16:55:49 -0200
committerRenato Botelho <renato@netgate.com>2015-10-20 16:55:49 -0200
commit54f236f78580e70710424caad13c170413cce5c6 (patch)
treea28cd936ef57d5d2a2a5a9048d24913430da0a1a /src/etc
parent6544cb185b84e535617d5b6c16bf1d2c57226cea (diff)
downloadpfsense-54f236f78580e70710424caad13c170413cce5c6.zip
pfsense-54f236f78580e70710424caad13c170413cce5c6.tar.gz
Change get_pkg_info() to also return installed_version
Diffstat (limited to 'src/etc')
-rw-r--r--src/etc/inc/pkg-utils.inc13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc
index 230ba5c..7ae0a62 100644
--- a/src/etc/inc/pkg-utils.inc
+++ b/src/etc/inc/pkg-utils.inc
@@ -435,6 +435,19 @@ function get_pkg_info($pkgs = 'all', $info = 'all') {
if (is_pkg_installed($pkg_info['name'])) {
$pkg_info['installed'] = true;
+
+ $rc = pkg_exec("query %v {$pkg_info['name']}", $out, $err);
+
+ if ($rc != 0) {
+ $static_output .= "\n" . gettext("ERROR: Error trying to get package version. Aborting...") . "\n";
+ $static_output .= $err;
+ $input_errors[] = gettext("ERROR: Error trying to get package version. Aborting...") . "\n";
+ $input_errors[] = $err;
+ update_status($static_output);
+ return array();
+ }
+
+ $pkg_info['installed_version'] = str_replace("\n", "", $out);
}
$pkg_info['desc'] = preg_replace('/\n+WWW:.*$/', '', $pkg_info['desc']);
OpenPOWER on IntegriCloud