mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-22 09:21:57 -05:00
Ports: Don't set previously unset environment variables
Co-authored-by: Tim Schumacher <timschumi@gmx.de> Co-authored-by: Jelle Raaijmakers <jelle@gmta.nl>
This commit is contained in:
parent
bdd3a16b16
commit
a6dd0e6339
1 changed files with 25 additions and 11 deletions
|
@ -1,13 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
exec env -i SERENITY_STRIPPED_ENV=1 \
|
||||
HOME="${HOME}" \
|
||||
USER="${USER}" \
|
||||
TERM="${TERM}" \
|
||||
PATH="${PATH}" \
|
||||
EDITOR="${EDITOR:-}" \
|
||||
MAKEJOBS="${MAKEJOBS:-}" \
|
||||
IN_SERENITY_PORT_DEV="${IN_SERENITY_PORT_DEV:-}" \
|
||||
SERENITY_ARCH="${SERENITY_ARCH:-}" \
|
||||
SERENITY_TOOLCHAIN="${SERENITY_TOOLCHAIN:-}" \
|
||||
"${@}"
|
||||
environment_variables=(
|
||||
"HOME=${HOME}"
|
||||
"PATH=${PATH}"
|
||||
"SERENITY_STRIPPED_ENV=1"
|
||||
"TERM=${TERM}"
|
||||
"USER=${USER}"
|
||||
)
|
||||
|
||||
# If any of the following optional variables are set, keep them.
|
||||
keep_environment_variables=(
|
||||
'EDITOR'
|
||||
'IN_SERENITY_PORT_DEV'
|
||||
'MAKEJOBS'
|
||||
'SERENITY_ARCH'
|
||||
'SERENITY_TOOLCHAIN'
|
||||
'VISUAL'
|
||||
)
|
||||
|
||||
for environment_variable_name in "${keep_environment_variables[@]}"; do
|
||||
if [ -v "${environment_variable_name}" ]; then
|
||||
environment_variables+=("${environment_variable_name}=${!environment_variable_name}")
|
||||
fi
|
||||
done
|
||||
|
||||
exec env -i "${environment_variables[@]}" "${@}"
|
||||
|
|
Loading…
Reference in a new issue