diff options
author | Luke Shumaker <lukeshu@parabola.nu> | 2017-02-15 15:00:12 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@parabola.nu> | 2017-02-19 14:21:29 -0500 |
commit | 58dfa71cb8d2db5ec4e53095760eb7b57529b28b (patch) | |
tree | 75b94db47f4e0041a97ded62f33f210fb656c8c4 | |
parent | fd5496ad28fe2bdd5ece90ce01e6e58a9fb0d615 (diff) |
mkarchroot: Don't let the environment affect pacstrap (sans proxy settings).
A previous iteration of this change (libretools commit d7dcce53396d)
simply inserted `env -i` to clear the environment.
However, that lead to it ignoring proxy settings, which some users had
problems with:
https://labs.parabola.nu/issues/487:
> To fix other bugs, the pacstrap environment is blank, which also
> means that the proxy settings are blank.
So (in libretools commit d17d1d82349f), I changed it to use `declare
-x` to inspect the environment, and create a version of it only
consisting of variables ending with "_proxy" (case-insensitive).
I honestly don't remember what "other bugs" prompted me to clear the
environment in the first place.
-rw-r--r-- | mkarchroot.in | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/mkarchroot.in b/mkarchroot.in index 4cf8e56..4ebafa6 100644 --- a/mkarchroot.in +++ b/mkarchroot.in @@ -81,6 +81,11 @@ for file in "${files[@]}"; do cp "$file" "$working_dir$file" done +_env=() +while read -r varname; do + _env+=("$varname=${!varname}") +done < <(declare -x | sed -r 's/^declare -x ([^=]*)=.*/\1/' | grep -i '_proxy$') +env -i "${_env[@]}" \ pacstrap -GMcd ${pac_conf:+-C "$pac_conf"} "$working_dir" \ "${cache_dirs[@]/#/--cachedir=}" "$@" || die 'Failed to install all packages' |