Skip to content

Commit 689da4d

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 689da4d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

install.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ 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" ]]; then
44+
BREW_NO_INSTALL="$(cat "/etc/homebrew/brew.no_install" 2>/dev/null)"
45+
if [[ -n "${BREW_NO_INSTALL}" ]]; then
46+
abort "Homebrew cannot be installed because ${BREW_NO_INSTALL}."
47+
else
48+
abort "Homebrew cannot be installed because /etc/homebrew/brew.no_install exists!"
49+
fi
50+
fi
51+
4252
# string formatters
4353
if [[ -t 1 ]]
4454
then

0 commit comments

Comments
 (0)