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.
This commit is contained in:
Luke Shumaker 2017-04-05 15:36:03 -04:00 committed by Jan Alexander Steffens (heftig)
parent 4228d79b63
commit 578a62f1e0
No known key found for this signature in database
GPG Key ID: A5E9288C4FA415FA
1 changed files with 5 additions and 0 deletions

View File

@ -78,6 +78,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'