Skip to content

Commit

Permalink
Merge pull request #58 from thedadams/proxy-from-args
Browse files Browse the repository at this point in the history
  • Loading branch information
Donnie Adams authored Sep 24, 2021
2 parents 14a2b5d + 6d7376f commit 2988707
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
13 changes: 9 additions & 4 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -627,10 +627,15 @@ ensure_systemd_service_stopped() {
create_env_file() {
FILE_SA_ENV="/etc/systemd/system/rancher-system-agent.env"
info "Creating environment file ${FILE_SA_ENV}"
UMASK=$(umask)
umask 0377
env | grep -E -i '^(NO|HTTP|HTTPS)_PROXY' | tee ${FILE_SA_ENV} >/dev/null
umask "${UMASK}"
install -m 0600 /dev/null "${FILE_SA_ENV}"
for i in "HTTP_PROXY" "HTTPS_PROXY" "NO_PROXY"; do
eval v=\"\$$i\"
if [ -z "${v}" ]; then
env | grep -E -i "^${i}" | tee -a ${FILE_SA_ENV} >/dev/null
else
echo "$i=$v" | tee -a ${FILE_SA_ENV} >/dev/null
fi
done
}

do_install() {
Expand Down
9 changes: 8 additions & 1 deletion package/suc/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ fi
export CATTLE_AGENT_BINARY_LOCAL=true
export CATTLE_AGENT_BINARY_LOCAL_LOCATION=${TMPDIR}/rancher-system-agent
if [ -s /host/etc/systemd/system/rancher-system-agent.env ]; then
export $(grep -v '^#' /host/etc/systemd/system/rancher-system-agent.env | xargs)
for line in $(grep -v '^#' /host/etc/systemd/system/rancher-system-agent.env); do
var=${line%%=*}
val=${line##*=}
eval v=\"\$$var\"
if [ -z "$v" ]; then
export "$var=$val"
fi
done
fi
chroot /host ${TMPDIR}/install.sh "$@"

Expand Down

0 comments on commit 2988707

Please sign in to comment.