summaryrefslogtreecommitdiffstats
path: root/src/etc/inc
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-01-07 19:14:44 -0200
committerRenato Botelho <renato@netgate.com>2016-01-07 19:15:08 -0200
commit6cf87aec745eb5b2f488ed3a4ec24b11a806b613 (patch)
tree5481e93162aed42351a5759c3e1c8a50d0093c07 /src/etc/inc
parent274351c5595b3dd976a4d2853907177791d23dfc (diff)
downloadpfsense-6cf87aec745eb5b2f488ed3a4ec24b11a806b613.zip
pfsense-6cf87aec745eb5b2f488ed3a4ec24b11a806b613.tar.gz
Do not set PKG_AUTOUPDATE=false anymore and let pkg to update metadata when it's necessary. Some users reported to see issues in cases where update was necessary
Diffstat (limited to 'src/etc/inc')
-rw-r--r--src/etc/inc/pkg-utils.inc48
1 files changed, 3 insertions, 45 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc
index e118896..55a0395 100644
--- a/src/etc/inc/pkg-utils.inc
+++ b/src/etc/inc/pkg-utils.inc
@@ -96,30 +96,7 @@ function pkg_remove_prefix(&$pkg_name) {
function pkg_update($force = false) {
global $g;
- $now = strftime('%s');
- $last_update_file="{$g['varrun_path']}/{$g['product_name']}-upgrade-last-update";
- if (!$force) {
- if (file_exists($last_update_file)) {
- $last_update = rtrim(file_get_contents($last_update_file), "\n");
- if (!is_numericint($last_update)) {
- $last_update = 0;
- }
- }
-
- if ($last_update > 0) {
- if ($now > $last_update && ($now - $last_update) <= (60 * 60)) {
- return true;
- }
- }
- }
-
- $rc = pkg_call("update");
-
- if ($rc) {
- file_put_contents($last_update_file, $now . "\n");
- }
-
- return $rc;
+ return pkg_call("update" . ($force ? " -f" : ""));
}
/* return an array with necessary environment vars for pkg */
@@ -128,8 +105,7 @@ function pkg_env() {
$pkg_env_vars = array(
"HTTP_USER_AGENT" => $user_agent,
- "ASSUME_ALWAYS_YES" => "true",
- "REPO_AUTOUPDATE" => "false"
+ "ASSUME_ALWAYS_YES" => "true"
);
if ($g['platform'] == "nanobsd" ||
@@ -409,21 +385,7 @@ function get_pkg_info($pkgs = 'all', $info = 'all') {
$pkgs = $g['pkg_prefix'];
}
- /* Make sure repo metadata is up2date */
- update_status("\n" .
- gettext("Updating package repository metadada...") . "\n");
-
- if (!pkg_update()) {
- $input_errors[] = gettext(
- "ERROR: An error occurred when updating packages repository. Aborting...")
- . "\n";
- update_status("\n" . gettext(
- "ERROR: An error occurred when updating packages repository. Aborting...")
- . "\n");
- return array();
- }
-
- $rc = pkg_exec("search -U --raw-format json-compact " . $pkgs, $out, $err);
+ $rc = pkg_exec("search --raw-format json-compact " . $pkgs, $out, $err);
if ($rc != 0) {
update_status("\n" . gettext(
@@ -993,10 +955,6 @@ function package_reinstall_all() {
sleep(1);
}
update_status("\n");
- } else {
- if (!pkg_update()) {
- return false;
- }
}
$pkg_info = get_pkg_info();
OpenPOWER on IntegriCloud