| 1 | #!/bin/sh |
| 2 | |
| 3 | . /etc/sysconfig/heat-params |
| 4 | |
| 5 | DOCKER_PROXY_CONF=/etc/systemd/system/docker.service.d/proxy.conf |
| 6 | BASH_RC=/etc/bashrc |
| 7 | |
| 8 | mkdir -p /etc/systemd/system/docker.service.d |
| 9 | |
| 10 | if [ -n "$HTTP_PROXY" ]; then |
| 11 | cat <<EOF | sed "s/^ *//" > $DOCKER_PROXY_CONF |
| 12 | [Service] |
| 13 | Environment=HTTP_PROXY=$HTTP_PROXY |
| 14 | EOF |
| 15 | |
| 16 | systemctl daemon-reload |
| 17 | systemctl --no-block restart docker.service |
| 18 | |
| 19 | if [ -f "$BASH_RC" ]; then |
| 20 | echo "declare -x http_proxy=$HTTP_PROXY" >> $BASH_RC |
| 21 | else |
| 22 | echo "File $BASH_RC does not exist, not setting http_proxy" |
| 23 | fi |
| 24 | fi |
| 25 | |
| 26 | if [ -n "$HTTPS_PROXY" ]; then |
| 27 | if [ -f "$BASH_RC" ]; then |
| 28 | echo "declare -x https_proxy=$HTTPS_PROXY" >> $BASH_RC |
| 29 | else |
| 30 | echo "File $BASH_RC does not exist, not setting https_proxy" |
| 31 | fi |
| 32 | fi |
| 33 | |
| 34 | if [ -n "$NO_PROXY" ]; then |
| 35 | if [ -f "$BASH_RC" ]; then |
| 36 | echo "declare -x no_proxy=$NO_PROXY" >> $BASH_RC |
| 37 | else |
| 38 | echo "File $BASH_RC does not exist, not setting no_proxy" |
| 39 | fi |
| 40 | fi |