Skip to content

Commit d91ee24

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 d91ee24

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

install.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ 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}" ]]; then
47+
abort "Homebrew cannot be installed because ${BREW_NO_INSTALL}."
48+
else
49+
abort "Homebrew cannot be installed because /etc/homebrew/brew.no_install exists!"
50+
fi
51+
fi
52+
4253
# string formatters
4354
if [[ -t 1 ]]
4455
then

0 commit comments

Comments
 (0)