diff options
author | jim-p <jimp@pfsense.org> | 2011-02-24 10:46:41 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2011-02-24 10:46:41 -0500 |
commit | 22beab884d2c93852058bdb6586227d9acd039e6 (patch) | |
tree | 1fda8e12e4700ff36c3184596798ecab3b55d5d3 /etc/inc/pkg-utils.inc | |
parent | 9011a843e8d66b610ae0ee129eefa183ed036e7a (diff) | |
download | pfsense-22beab884d2c93852058bdb6586227d9acd039e6.zip pfsense-22beab884d2c93852058bdb6586227d9acd039e6.tar.gz |
Move this code up a bit and also use /root/tmp to fetch packages instead of /tmp so it won't fill up.
Diffstat (limited to 'etc/inc/pkg-utils.inc')
-rw-r--r-- | etc/inc/pkg-utils.inc | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc index 44ea36c..3f901e2 100644 --- a/etc/inc/pkg-utils.inc +++ b/etc/inc/pkg-utils.inc @@ -451,6 +451,14 @@ function sync_package($pkg_name, $sync_depends = true, $show_message = false) { function pkg_fetch_recursive($pkgname, $filename, $dependlevel = 0, $base_url = "") { global $static_output, $g; + if (($g['platform'] == "nanobsd") || ($g['platform'] == "embedded")) { + $pkgtmpdir = "/usr/bin/env PKG_TMPDIR=/root/ "; + $pkgstaging = "-t /root/tmp/instmp.XXXXXX"; + $fetchdir = "/root/tmp/"; + } else { + $fetchdir = $g['tmp_path']; + } + $osname = php_uname("s"); $arch = php_uname("m"); $rel = strtolower(php_uname("r")); @@ -461,7 +469,7 @@ function pkg_fetch_recursive($pkgname, $filename, $dependlevel = 0, $base_url = $base_url = $priv_url; if (substr($base_url, -1) == "/") $base_url = substr($base_url, 0, -1); - $fetchto = "{$g['tmp_path']}/apkg_{$filename}"; + $fetchto = "{$fetchdir}/apkg_{$filename}"; $static_output .= "\n" . str_repeat(" ", $dependlevel * 2 + 1) . "Downloading {$base_url}/{$filename} ... "; if (download_file_with_progress_bar("{$base_url}/{$filename}", $fetchto) !== true) { if ($base_url != $priv_url && download_file_with_progress_bar("{$priv_url}/{$filename}", $fetchto) !== true) { @@ -498,10 +506,7 @@ function pkg_fetch_recursive($pkgname, $filename, $dependlevel = 0, $base_url = } } } - if (($g['platform'] == "nanobsd") || ($g['platform'] == "embedded")) { - $pkgtmpdir = "/usr/bin/env PKG_TMPDIR=/root/ "; - $pkgstaging = "-t /root/tmp/instmp.XXXXXX"; - } + $pkgaddout = ""; exec("{$pkgtmpdir}/usr/sbin/pkg_add {$pkgstaging} -fv {$fetchto} 2>&1", $pkgaddout); pkg_debug($pkgname . " " . print_r($pkgaddout, true) . "\npkg_add successfully completed.\n"); |