Default environment filtering to on for all users.
This commit is contained in:
parent
8de97dca14
commit
e13a93dd75
@ -246,6 +246,18 @@ case "$HOMEBREW_COMMAND" in
|
||||
--config) HOMEBREW_COMMAND="config" ;;
|
||||
esac
|
||||
|
||||
# Set HOMEBREW_DEV_CMD_RUN for users who have run a development command.
|
||||
# This makes them behave like HOMEBREW_DEVELOPERs for brew update.
|
||||
if [[ -z "$HOMEBREW_DEVELOPER" ]]
|
||||
then
|
||||
export HOMEBREW_GIT_CONFIG_FILE="$HOMEBREW_REPOSITORY/.git/config"
|
||||
HOMEBREW_GIT_CONFIG_DEVELOPERMODE="$(git config --file="$HOMEBREW_GIT_CONFIG_FILE" --get homebrew.devcmdrun 2>/dev/null)"
|
||||
if [[ "$HOMEBREW_GIT_CONFIG_DEVELOPERMODE" = "true" ]]
|
||||
then
|
||||
export HOMEBREW_DEV_CMD_RUN="1"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -f "$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh" ]]
|
||||
then
|
||||
HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$HOMEBREW_COMMAND.sh"
|
||||
|
||||
28
bin/brew
28
bin/brew
@ -59,35 +59,13 @@ do
|
||||
export "$VAR_NEW"="${!VAR}"
|
||||
done
|
||||
|
||||
# Set HOMEBREW_DEVELOPER for users who have run a development command
|
||||
if [[ -z "$HOMEBREW_DEVELOPER" ]]
|
||||
then
|
||||
export HOMEBREW_GIT_CONFIG_FILE="$HOMEBREW_REPOSITORY/.git/config"
|
||||
HOMEBREW_GIT_CONFIG_DEVELOPERMODE="$(git config --file="$HOMEBREW_GIT_CONFIG_FILE" --get homebrew.devcmdrun 2>/dev/null)"
|
||||
if [[ "$HOMEBREW_GIT_CONFIG_DEVELOPERMODE" = "true" ]]
|
||||
then
|
||||
export HOMEBREW_DEV_CMD_RUN="1"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -z "$HOMEBREW_NO_ENV_FILTERING" ]]
|
||||
then
|
||||
if [[ -n "$HOMEBREW_DEVELOPER" || -n "$HOMEBREW_DEV_CMD_RUN" ]]
|
||||
then
|
||||
# Use env filtering by default for users who have run a development command
|
||||
# This will be enabled by default for all users in future.
|
||||
export HOMEBREW_ENV_FILTERING="1"
|
||||
fi
|
||||
else
|
||||
unset HOMEBREW_ENV_FILTERING
|
||||
fi
|
||||
|
||||
# test-bot sets environment filtering itself
|
||||
if [[ -n "$HOMEBREW_ENV_FILTERING" && "$1" != "test-bot" ]]
|
||||
# test-bot does environment filtering itself
|
||||
if [[ -z "$HOMEBREW_NO_ENV_FILTERING" && "$1" != "test-bot" ]]
|
||||
then
|
||||
PATH="/usr/bin:/bin:/usr/sbin:/sbin"
|
||||
|
||||
FILTERED_ENV=()
|
||||
# Filter all but the specific variables.
|
||||
for VAR in HOME SHELL PATH TERM LOGNAME USER CI TRAVIS SSH_AUTH_SOCK SUDO_ASKPASS \
|
||||
http_proxy https_proxy ftp_proxy HTTPS_PROXY FTP_PROXY \
|
||||
"${!HOMEBREW_@}" "${!TRAVIS_@}" "${!JENKINS_@}"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user