mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
bin/brew: handle missing $HOME
.
Try to build it using `$USER` or `$LOGNAME` and, if both are missing, just give up.
This commit is contained in:
parent
24b6b3494d
commit
59ea118991
23
bin/brew
23
bin/brew
@ -105,9 +105,30 @@ fi
|
|||||||
if [[ -n "${XDG_CONFIG_HOME-}" ]]
|
if [[ -n "${XDG_CONFIG_HOME-}" ]]
|
||||||
then
|
then
|
||||||
HOMEBREW_USER_CONFIG_HOME="${XDG_CONFIG_HOME}/homebrew"
|
HOMEBREW_USER_CONFIG_HOME="${XDG_CONFIG_HOME}/homebrew"
|
||||||
else
|
elif [[ -n "${HOME-}" ]]
|
||||||
|
then
|
||||||
HOMEBREW_USER_CONFIG_HOME="${HOME}/.homebrew"
|
HOMEBREW_USER_CONFIG_HOME="${HOME}/.homebrew"
|
||||||
|
elif [[ -n "${USER-}" ]]
|
||||||
|
then
|
||||||
|
if [[ "${OSTYPE}" == "darwin"* ]]
|
||||||
|
then
|
||||||
|
HOMEBREW_USER_CONFIG_HOME="/Users/${USER}/.homebrew"
|
||||||
|
else
|
||||||
|
HOMEBREW_USER_CONFIG_HOME="/home/${USER}/.homebrew"
|
||||||
|
fi
|
||||||
|
elif [[ -n "${LOGNAME-}" ]]
|
||||||
|
then
|
||||||
|
if [[ "${OSTYPE}" == "darwin"* ]]
|
||||||
|
then
|
||||||
|
HOMEBREW_USER_CONFIG_HOME="/Users/${LOGNAME}/.homebrew"
|
||||||
|
else
|
||||||
|
HOMEBREW_USER_CONFIG_HOME="/home/${LOGNAME}/.homebrew"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error: \$HOME or \$USER or \$LOGNAME must be set to run brew." >&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "${HOMEBREW_USER_CONFIG_HOME}/brew.env" ]]
|
if [[ -f "${HOMEBREW_USER_CONFIG_HOME}/brew.env" ]]
|
||||||
then
|
then
|
||||||
# only load HOMEBREW_*=* lines
|
# only load HOMEBREW_*=* lines
|
||||||
|
Loading…
x
Reference in New Issue
Block a user