summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2016-04-19 15:10:03 -0400
committerjim-p <jimp@pfsense.org>2016-04-19 15:10:35 -0400
commita7fcbc1ec9ed1a8f0ca83c85281250bea777f262 (patch)
tree15db3ccac84412e95630762bf93b8ba7421581f3 /src
parentd1ee3405d2cfdfd3ee79743586655a8b999f770e (diff)
downloadpfsense-a7fcbc1ec9ed1a8f0ca83c85281250bea777f262.zip
pfsense-a7fcbc1ec9ed1a8f0ca83c85281250bea777f262.tar.gz
Setup HTTP_PROXY environment variable for pkg when it's called from the GUI and also for pfSense-upgrade
Diffstat (limited to 'src')
-rw-r--r--src/etc/inc/pkg-utils.inc8
-rwxr-xr-xsrc/usr/local/sbin/pfSense-upgrade10
2 files changed, 18 insertions, 0 deletions
diff --git a/src/etc/inc/pkg-utils.inc b/src/etc/inc/pkg-utils.inc
index 48cce82..a759aae 100644
--- a/src/etc/inc/pkg-utils.inc
+++ b/src/etc/inc/pkg-utils.inc
@@ -109,6 +109,14 @@ function pkg_env($extra_env = array()) {
"ASSUME_ALWAYS_YES" => "true"
);
+ if (!empty($config['system']['proxyurl'])) {
+ $http_proxy = $config['system']['proxyurl'];
+ if (!empty($config['system']['proxyport'])) {
+ $http_proxy .= ':' . $config['system']['proxyport'];
+ }
+ $pkg_env_vars['HTTP_PROXY'] = $http_proxy;
+ }
+
if ($g['platform'] == "nanobsd" ||
isset($config['system']['use_mfs_tmpvar'])) {
$pkg_env_vars['PKG_DBDIR'] = '/root/var/db/pkg';
diff --git a/src/usr/local/sbin/pfSense-upgrade b/src/usr/local/sbin/pfSense-upgrade
index 051c0b8..b5b7e5a 100755
--- a/src/usr/local/sbin/pfSense-upgrade
+++ b/src/usr/local/sbin/pfSense-upgrade
@@ -732,6 +732,16 @@ pid_file="/var/run/$(basename $0).pid"
logfile="/cf/conf/upgrade_log.txt"
stdout='/dev/null'
+# Setup proxy settings
+HTTP_PROXY=$(/usr/local/sbin/read_xml_tag.sh string system/proxyurl)
+if [ "${HTTP_PROXY}" != "" ]; then
+ HTTP_PROXY_PORT=$(/usr/local/sbin/read_xml_tag.sh string system/proxyport)
+ if [ "${HTTP_PROXY_PORT}" != "" ]; then
+ HTTP_PROXY="${HTTP_PROXY}:${HTTP_PROXY_PORT}"
+ fi
+ export HTTP_PROXY
+fi
+
# pkg should not ask for confirmations
export ASSUME_ALWAYS_YES=true
OpenPOWER on IntegriCloud