Merge "local-config: Configure proxy for zypper repos"

This commit is contained in:
Jenkins 2013-12-11 09:50:54 +00:00 committed by Gerrit Code Review
commit ca667d0a33
2 changed files with 13 additions and 4 deletions

View File

@ -11,6 +11,9 @@ fi
if [ -e /etc/yum.conf ] ; then if [ -e /etc/yum.conf ] ; then
have_yum=1 have_yum=1
fi fi
if [ -d /etc/zypp ] ; then
have_zypper=1
fi
if [ -n "$http_proxy" ]; then if [ -n "$http_proxy" ]; then
if [ -d ~stack ]; then if [ -d ~stack ]; then
@ -22,6 +25,9 @@ if [ -n "$http_proxy" ]; then
if [ -n "$have_yum" ] ; then if [ -n "$have_yum" ] ; then
sed -i -e "s,\[main\],[main]\nproxy=$http_proxy," /etc/yum.conf sed -i -e "s,\[main\],[main]\nproxy=$http_proxy," /etc/yum.conf
fi fi
if [ -n "$have_zypper" ] ; then
sed -i -e "s,^HTTP_PROXY=.*$,HTTP_PROXY=\"$http_proxy\"," /etc/sysconfig/proxy
fi
fi fi
if [ -n "$https_proxy" ]; then if [ -n "$https_proxy" ]; then
@ -31,10 +37,17 @@ if [ -n "$https_proxy" ]; then
if [ -n "$have_apt" ] ; then if [ -n "$have_apt" ] ; then
echo "Acquire::https::Proxy \"$https_proxy\";" > /etc/apt/apt.conf.d/61-use-https-proxy echo "Acquire::https::Proxy \"$https_proxy\";" > /etc/apt/apt.conf.d/61-use-https-proxy
fi fi
if [ -n "$have_zypper" ] ; then
sed -i -e "s,^HTTPS_PROXY=.*$,HTTPS_PROXY=\"$https_proxy\"," /etc/sysconfig/proxy
fi
fi fi
if [ -n "$http_proxy" -o -n "$https_proxy" ]; then if [ -n "$http_proxy" -o -n "$https_proxy" ]; then
if [ -d ~stack ]; then if [ -d ~stack ]; then
echo export no_proxy=192.0.2.1 >> ~stack/.profile echo export no_proxy=192.0.2.1 >> ~stack/.profile
fi fi
if [ -n "$have_zypper" ] ; then
sed -i -e "s,^PROXY_ENABLED=.*$,PROXY_ENABLED=\"yes\"," \
-e "s,^\(NO_PROXY=.*\)\"$,\1\, 192.0.2.1\"," /etc/sysconfig/proxy
fi
fi fi

View File

@ -20,7 +20,3 @@ Notes:
hooks. The exceptions are 01-install-bin, which has been copied to hooks. The exceptions are 01-install-bin, which has been copied to
this element, and 01-override-zypp-arch (which is something that this element, and 01-override-zypp-arch (which is something that
could probably be jammed into the base image...). could probably be jammed into the base image...).
* We might want to use the local-config element (after updating that element to
inject http\_proxy properly for openSUSE, of course).
(https://bugs.launchpad.net/diskimage-builder/+bug/1256982)