Skip to content

Commit 956abfa

Browse files
committed
install.sh: check for file that prevents Homebrew installation.
Add support for a `/etc/homebrew/brew.no_install` file that can be used to prevent running the Homebrew installation script and optionally provide a message to the user.
1 parent e831048 commit 956abfa

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

install.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ then
3939
abort 'Bash must not run in POSIX mode. Please unset POSIXLY_CORRECT and try again.'
4040
fi
4141

42+
# Check for file that prevents Homebrew installation
43+
if [[ -f "/etc/homebrew/brew.no_install" ]]
44+
then
45+
BREW_NO_INSTALL="$(cat "/etc/homebrew/brew.no_install" 2>/dev/null)"
46+
if [[ -n "${BREW_NO_INSTALL}" ]]
47+
then
48+
abort "Homebrew cannot be installed because ${BREW_NO_INSTALL}."
49+
else
50+
abort "Homebrew cannot be installed because /etc/homebrew/brew.no_install exists!"
51+
fi
52+
fi
53+
4254
# string formatters
4355
if [[ -t 1 ]]
4456
then

0 commit comments

Comments
 (0)