preinstall: correctly handle headless installs

This commit is contained in:
Sean Molenaar 2022-12-21 13:37:24 +01:00 committed by GitHub
parent f6a9980e49
commit d2aed31387
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,9 +5,12 @@ if [[ -e "/Library/Developer/CommandLineTools/usr/bin/git" ]]; then
exit 0
fi
if /usr/bin/xcode-select --install; then
exit 0
if [[ -z "$COMMAND_LINE_INSTALL" ]]; then
printf "No auto-install of CommandLine Tools in headless install!"
exit 1
fi
printf "Failed to install CommandLine Tools"
if ! /usr/bin/xcode-select --install; then
printf "Failed to install CommandLine Tools!"
exit 1
fi