summaryrefslogtreecommitdiffstats
path: root/src/etc/inc
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-01-07 18:29:49 -0200
committerRenato Botelho <renato@netgate.com>2016-01-07 19:15:08 -0200
commit500dfdb80785b78be0c79bf1840c9e581e9a20ca (patch)
tree6af8c4d75a1d76746439da9da5fb06073fc78fa6 /src/etc/inc
parent277b83dd883dc2fe1cfb225b0a352809d4d250a6 (diff)
downloadpfsense-500dfdb80785b78be0c79bf1840c9e581e9a20ca.zip
pfsense-500dfdb80785b78be0c79bf1840c9e581e9a20ca.tar.gz
Revert "Avoid mounting / rw without need when it's possible"
This reverts commit 0305284cf2d66119d6df8e57cdc52eb3b4d478af.
Diffstat (limited to 'src/etc/inc')
-rw-r--r--src/etc/inc/pkg-utils.inc36
1 files changed, 12 insertions, 24 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc
index fc0a126..c3f3b5f 100644
--- a/src/etc/inc/pkg-utils.inc
+++ b/src/etc/inc/pkg-utils.inc
@@ -142,7 +142,7 @@ function pkg_env() {
}
/* Execute a pkg call */
-function pkg_call($params, $mute = false, $readonly = false) {
+function pkg_call($params, $mute = false) {
global $g, $config;
if (empty($params)) {
@@ -159,18 +159,14 @@ function pkg_call($params, $mute = false, $readonly = false) {
2 => array("pipe", "w") /* stderr */
);
- if (!$readonly) {
- conf_mount_rw();
- }
+ conf_mount_rw();
pkg_debug("pkg_call(): {$params}\n");
$process = proc_open("/usr/sbin/pkg {$params}", $descriptorspec, $pipes,
'/', pkg_env());
if (!is_resource($process)) {
- if (!$readonly) {
- conf_mount_ro();
- }
+ conf_mount_ro();
return false;
}
@@ -222,9 +218,7 @@ function pkg_call($params, $mute = false, $readonly = false) {
fclose($pipes[2]);
proc_close($process);
- if (!$readonly) {
- conf_mount_ro();
- }
+ conf_mount_ro();
if (!isset($rc)) {
$rc = $status['exitcode'];
@@ -246,7 +240,7 @@ function pkg_call($params, $mute = false, $readonly = false) {
}
/* Execute pkg with $params, fill stdout and stderr and return pkg rc */
-function pkg_exec($params, &$stdout, &$stderr, $readonly = false) {
+function pkg_exec($params, &$stdout, &$stderr) {
global $g, $config;
if (empty($params)) {
@@ -263,18 +257,14 @@ function pkg_exec($params, &$stdout, &$stderr, $readonly = false) {
2 => array("pipe", "w") /* stderr */
);
- if (!$readonly) {
- conf_mount_rw();
- }
+ conf_mount_rw();
pkg_debug("pkg_exec(): {$params}\n");
$process = proc_open("/usr/sbin/pkg {$params}", $descriptorspec, $pipes,
'/', pkg_env());
if (!is_resource($process)) {
- if (!$readonly) {
- conf_mount_ro();
- }
+ conf_mount_ro();
return -1;
}
@@ -290,9 +280,7 @@ function pkg_exec($params, &$stdout, &$stderr, $readonly = false) {
}
fclose($pipes[2]);
- if (!$readonly) {
- conf_mount_ro();
- }
+ conf_mount_ro();
return proc_close($process);
}
@@ -308,7 +296,7 @@ function pkg_version_compare($v1, $v2) {
return '?';
}
- $rc = pkg_exec("version -t '{$v1}' '{$v2}'", $stdout, $stderr, true);
+ $rc = pkg_exec("version -t '{$v1}' '{$v2}'", $stdout, $stderr);
if ($rc != 0) {
return '?';
@@ -325,7 +313,7 @@ function is_pkg_installed($pkg_name) {
return false;
}
- return pkg_call("info -e " . $pkg_name, true, true);
+ return pkg_call("info -e " . $pkg_name, true);
}
/* Install package, $pkg_name should not contain prefix */
@@ -435,7 +423,7 @@ function get_pkg_info($pkgs = 'all', $info = 'all') {
return array();
}
- $rc = pkg_exec("search -U --raw-format json-compact " . $pkgs, $out, $err, true);
+ $rc = pkg_exec("search -U --raw-format json-compact " . $pkgs, $out, $err);
if ($rc != 0) {
update_status("\n" . gettext(
@@ -470,7 +458,7 @@ 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, true);
+ $rc = pkg_exec("query %v {$pkg_info['name']}", $out, $err);
if ($rc != 0) {
update_status("\n" . gettext(
OpenPOWER on IntegriCloud