From d650ed4a14d82215b3848abbf194c9a96d9926b0 Mon Sep 17 00:00:00 2001 From: Song Fuchang Date: Thu, 8 Sep 2022 10:06:17 +0000 Subject: [PATCH] pmb.chroot.root: preserve proxy environment variables (MR 2201) This fixes #457. --- pmb/chroot/root.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pmb/chroot/root.py b/pmb/chroot/root.py index b3468af2..5f0f240d 100644 --- a/pmb/chroot/root.py +++ b/pmb/chroot/root.py @@ -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"]