From 4da169ce6e6e91c1a228e263e908a578d86c46ae Mon Sep 17 00:00:00 2001 From: Clint Byrum Date: Fri, 8 Mar 2013 03:24:45 -0800 Subject: [PATCH] local-config: Configure proxy for apt and/or yum Fixes fail to build image on Fedora Change-Id: I30324081702ffc68e82499d81a841c8ae17119ce --- elements/local-config/install.d/61-http-proxy | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/elements/local-config/install.d/61-http-proxy b/elements/local-config/install.d/61-http-proxy index b10e00bb5..b4b686ebf 100755 --- a/elements/local-config/install.d/61-http-proxy +++ b/elements/local-config/install.d/61-http-proxy @@ -5,18 +5,32 @@ set -e set -o xtrace +if [ -d /etc/apt ] ; then + have_apt=1 +fi +if [ -e /etc/yum.conf ] ; then + have_yum=1 +fi + if [ -n "$http_proxy" ]; then if [ -d ~stack ]; then echo export http_proxy=$http_proxy >> ~stack/.profile fi - echo "Acquire::http::Proxy \"$http_proxy\";" > /etc/apt/apt.conf.d/61-use-http-proxy + if [ -n "$have_apt" ] ; then + echo "Acquire::http::Proxy \"$http_proxy\";" > /etc/apt/apt.conf.d/61-use-http-proxy + fi + if [ -n "$have_yum" ] ; then + sed -i -e "s,\[main\],[main]\nproxy=$http_proxy," /etc/yum.conf + fi fi if [ -n "$https_proxy" ]; then if [ -d ~stack ]; then echo export https_proxy=$https_proxy >> ~stack/.profile fi - echo "Acquire::https::Proxy \"$https_proxy\";" > /etc/apt/apt.conf.d/61-use-https-proxy + if [ -n "$have_apt" ] ; then + echo "Acquire::https::Proxy \"$https_proxy\";" > /etc/apt/apt.conf.d/61-use-https-proxy + fi fi if [ -n "$http_proxy" -o -n "$https_proxy" ]; then