pmb.chroot.root: preserve proxy environment variables (MR 2201)

This fixes #457.
This commit is contained in:
Song Fuchang 2022-09-08 10:06:17 +00:00 committed by notsyncing
parent 52530caaf8
commit d650ed4a14
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 6 additions and 0 deletions

View File

@ -64,6 +64,12 @@ def root(args, cmd, suffix="native", working_dir="/", output="log",
for key, value in env.items():
env_all[key] = value
# Preserve proxy environment variables
for var in ["FTP_PROXY", "ftp_proxy", "HTTP_PROXY", "http_proxy",
"HTTPS_PROXY", "https_proxy", "HTTP_PROXY_AUTH"]:
if var in os.environ:
env_all[var] = os.environ[var]
# Build the command in steps and run it, e.g.:
# cmd: ["echo", "test"]
# cmd_chroot: ["/sbin/chroot", "/..._native", "/bin/sh", "-c", "echo test"]