summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorstilez <stilez@users.noreply.github.com>2017-01-26 07:11:34 +0000
committerRenato Botelho <renato@netgate.com>2017-01-30 13:33:27 -0200
commitc6995b29d0a2e7acd959952f5509f8f79f7e3255 (patch)
tree6adfdac9d007dbbcd35bf0f08f9a17d95cbeefb4 /src
parent1f9edebb4dce80939a0dba9e05341bace3f598e2 (diff)
downloadpfsense-c6995b29d0a2e7acd959952f5509f8f79f7e3255.zip
pfsense-c6995b29d0a2e7acd959952f5509f8f79f7e3255.tar.gz
fix copy/paste - I think!
(cherry picked from commit 2f633b526075b2ed5e0e160ef6f0d025b509bd70)
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/pkg-utils.inc38
1 files changed, 6 insertions, 32 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc
index 7f6ddac..82210c2 100644
--- a/src/etc/inc/pkg-utils.inc
+++ b/src/etc/inc/pkg-utils.inc
@@ -427,40 +427,14 @@ function get_pkg_info($pkgs = 'all', $local_only = false, $installed_only = fals
* enables offline view + management of installed pkgs.
*/
- // pkg info errors if none match, unlike pkg search, so test it will work beforehand...
- if (
+ // pkg info errors if none match, unlike pkg search, so test it will work beforehand
+ // is_package_installed() is a wrapper for pkg info -e <pattern> which is what we need here.
- $extra_param = "";
- if ($local_only) {
- $extra_param = "-U ";
- }
-
- if ($lock) {
- mark_subsystem_dirty('pkg');
- }
-
- if (!$installed_only) {
- // repo catalog search (either remote or local_only)
- $rc = pkg_exec("search {$extra_param}-R --raw-format json-compact " . $pkgs, $out, $err);
- }
- if ($installed_only || ($local_only && $rc != 0)) {
- /* use pkg info if (1) installed pkg search or (2) local catalog copy search requested + failed.
- *
- * The local repo catalog copy may be cleared if a previous call to pkg search couldn't get the
- * remote repo catalog.
- *
- * If the calling code would have accepted local copy info (which isn't assumed up to date) then it
- * makes sense to fall back on pkg info to at least return the known info about installed pkgs (pkg
- * info should still work), instead of failing and returning no info at all. For example, this
- * enables offline view + management of installed pkgs.
- */
+ if (is_package_installed($pkgs)) {
+ // ok, 1 or more packages match, so pkg info can be safely called to get the pkg list
+ $rc = pkg_exec("info -R --raw-format json-compact " . $pkgs, $out, $err);
+ } // else we already have empty values for $out etc which are correct if none matched
- // pkg info errors if none match, unlike pkg search, so test it will work beforehand
- // is_package_installed() is a wrapper for pkg info -e <pattern> which is what we need here.
- if (is_package_installed($pkgs)) {
- // ok, 1 or more packages match, so pkg info can be safely called to get the pkg list
- $rc = pkg_exec("info -R --raw-format json-compact " . $pkgs, $out, $err);
- } // else we already have empty values for $out etc which are correct if none matched
}
if ($lock) {
clear_subsystem_dirty('pkg');
OpenPOWER on IntegriCloud