Files
fluffy-pancake/files/usr/local/bin/install-homebrew.sh
T
humocs-manandGitHub 84981d7271 Enhance install-homebrew.sh with user validation
Added error handling and user check for Homebrew installation.
2026-03-14 15:16:26 +01:00

21 lines
481 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
set -euo pipefail
if [[ -z "${1:-}" ]]; then
echo "Kein Benutzer angegeben breche ab." >&2
exit 1
fi
USER="$1"
# Brew bereits vorhanden?
if sudo -u "$USER" command -v brew >/dev/null 2>&1; then
echo "Homebrew ist bereits installiert überspringe."
exit 0
fi
echo "Installiere Homebrew für Benutzer: $USER"
sudo -u "$USER" NONINTERACTIVE=1 \
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"