local-config: Configure proxy for zypper repos

This allows using the local-config element with openSUSE based images.

Closes-Bug: #1256982
Change-Id: I670c938a44095ea7e7c31b81194acc1555212f06
This commit is contained in:
Ralf Haferkamp 2013-12-09 21:13:20 +01:00
parent 31ff8235a3
commit f6c2901b0a
2 changed files with 13 additions and 4 deletions

View File

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

View File

@ -20,7 +20,3 @@ Notes:
hooks. The exceptions are 01-install-bin, which has been copied to
this element, and 01-override-zypp-arch (which is something that
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)