tripleo-image-elements/elements/local-config/install.d/61-http-proxy

41 lines
982 B
Bash
Executable File

#!/bin/bash
# Save the HTTP if one is available.
# XXX: Obviously not suitable for downloadable images.
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
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
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
if [ -d ~stack ]; then
echo export no_proxy=192.0.2.1 >> ~stack/.profile
fi
fi