pmb.helpers.run_core: always configure proxy vars if set in environment
By configuring proxy vars in run_core.core, we can ensure that the environment is always aware of any configured proxy, whether it's running natively or in a chroot. fixes https://gitlab.com/postmarketOS/pmbootstrap/-/issues/2249 Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org> Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230713021822.15223-2-clayton@craftyguy.net%3E
This commit is contained in:
parent
caf4d779e3
commit
1a00c04f74
|
@ -65,12 +65,6 @@ def root(args, cmd, suffix="native", working_dir="/", output="log",
|
||||||
for key, value in env.items():
|
for key, value in env.items():
|
||||||
env_all[key] = value
|
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.:
|
# Build the command in steps and run it, e.g.:
|
||||||
# cmd: ["echo", "test"]
|
# cmd: ["echo", "test"]
|
||||||
# cmd_chroot: ["/sbin/chroot", "/..._native", "/bin/sh", "-c", "echo test"]
|
# cmd_chroot: ["/sbin/chroot", "/..._native", "/bin/sh", "-c", "echo test"]
|
||||||
|
|
|
@ -310,6 +310,13 @@ def core(args, log_message, cmd, working_dir=None, output="log",
|
||||||
"""
|
"""
|
||||||
sanity_checks(output, output_return, check)
|
sanity_checks(output, output_return, check)
|
||||||
|
|
||||||
|
# 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:
|
||||||
|
# Prepend setting var to cmd string
|
||||||
|
cmd = f"{var}={os.environ[var]} {cmd}"
|
||||||
|
|
||||||
if args.sudo_timer and sudo:
|
if args.sudo_timer and sudo:
|
||||||
sudo_timer_start()
|
sudo_timer_start()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue