From f6c2901b0acb280916498cd78953343a150d4484 Mon Sep 17 00:00:00 2001 From: Ralf Haferkamp Date: Mon, 9 Dec 2013 21:13:20 +0100 Subject: [PATCH] local-config: Configure proxy for zypper repos This allows using the local-config element with openSUSE based images. Closes-Bug: #1256982 Change-Id: I670c938a44095ea7e7c31b81194acc1555212f06 --- elements/local-config/install.d/61-http-proxy | 13 +++++++++++++ elements/opensuse/README.md | 4 ---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/elements/local-config/install.d/61-http-proxy b/elements/local-config/install.d/61-http-proxy index b4b686ebf..255df7e68 100755 --- a/elements/local-config/install.d/61-http-proxy +++ b/elements/local-config/install.d/61-http-proxy @@ -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 diff --git a/elements/opensuse/README.md b/elements/opensuse/README.md index 49e031b7d..383acc41f 100644 --- a/elements/opensuse/README.md +++ b/elements/opensuse/README.md @@ -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) -