Fixed permission issue to run as non-root

Fixed the permission denied issue, if this script is run as non-root
to set the proxy settings for apt and docker.

Change-Id: I9b5913d40ba552c976dc910a106371280e9e8794
This commit is contained in:
Ahmad Mahmoudi 2018-09-14 23:01:18 +00:00
parent 75ff600a20
commit 4efa557d48
1 changed files with 4 additions and 4 deletions

View File

@ -60,14 +60,14 @@ HTTPS_PROXY=${HTTP_PROXY:-${http_proxy}}
if [[ ! -z "${HTTPS_PROXY}" ]]
then
log_stage_header "Configuring Apt Proxy"
sudo cat << EOF > /etc/apt/apt.conf.d/50proxyconf
Acquire::https::proxy \"${HTTPS_PROXY}\";
Acquire::http::proxy \"${HTTPS_PROXY}\";
cat << EOF | sudo tee /etc/apt/apt.conf.d/50proxyconf
Acquire::https::proxy "${HTTPS_PROXY}";
Acquire::http::proxy "${HTTPS_PROXY}";
EOF
log_stage_header "Configuring Docker Proxy"
sudo mkdir -p /etc/systemd/system/docker.service.d/
sudo cat << EOF > /etc/systemd/system/docker.service.d/proxy.conf
cat << EOF | sudo tee /etc/systemd/system/docker.service.d/proxy.conf
[Service]
Environment="HTTP_PROXY=${HTTP_PROXY}"
Environment="HTTPS_PROXY=${HTTPS_PROXY}"