Bootstrap Homebrew before git clone in all setup scripts
On a fresh Mac, git is a stub that requires Xcode CLT. The Homebrew installer handles Xcode CLT automatically, so install Homebrew inline first, then use git to clone the repo. This fixes the source failure when step files are not yet available.
This commit is contained in:
parent
8a06384cc1
commit
93d3f67180
3 changed files with 30 additions and 3 deletions
11
setup.sh
11
setup.sh
|
|
@ -19,8 +19,17 @@ _error() { echo -e "${RED}✗ $1${NC}"; exit 1; }
|
||||||
[[ "$OSTYPE" != "darwin"* ]] && _error "This script is designed for macOS."
|
[[ "$OSTYPE" != "darwin"* ]] && _error "This script is designed for macOS."
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Clone or update the repo first so step files are available
|
# Bootstrap: Homebrew first (installs Xcode CLT → git), then clone the repo
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
if ! command -v brew &>/dev/null; then
|
||||||
|
_info "Installing Homebrew (this also installs git via Xcode CLT)..."
|
||||||
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
|
echo >> ~/.zprofile
|
||||||
|
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
|
||||||
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
|
_success "Homebrew installed"
|
||||||
|
fi
|
||||||
|
|
||||||
_info "Setting up riotsecure repository..."
|
_info "Setting up riotsecure repository..."
|
||||||
if [ -d ~/riotsecure ]; then
|
if [ -d ~/riotsecure ]; then
|
||||||
_warning "Repository already exists — updating..."
|
_warning "Repository already exists — updating..."
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,17 @@ _error() { echo -e "${RED}✗ $1${NC}"; exit 1; }
|
||||||
[[ "$OSTYPE" != "darwin"* ]] && _error "This script is designed for macOS."
|
[[ "$OSTYPE" != "darwin"* ]] && _error "This script is designed for macOS."
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Clone or update the repo first so step files are available
|
# Bootstrap: Homebrew first (installs Xcode CLT → git), then clone the repo
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
if ! command -v brew &>/dev/null; then
|
||||||
|
_info "Installing Homebrew (this also installs git via Xcode CLT)..."
|
||||||
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
|
echo >> ~/.zprofile
|
||||||
|
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
|
||||||
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
|
_success "Homebrew installed"
|
||||||
|
fi
|
||||||
|
|
||||||
_info "Setting up riotsecure repository..."
|
_info "Setting up riotsecure repository..."
|
||||||
if [ -d ~/riotsecure ]; then
|
if [ -d ~/riotsecure ]; then
|
||||||
_warning "Repository already exists — updating..."
|
_warning "Repository already exists — updating..."
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,17 @@ while [[ $# -gt 0 ]]; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Clone or update the repo first so step files are available
|
# Bootstrap: Homebrew first (installs Xcode CLT → git), then clone the repo
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
if ! command -v brew &>/dev/null; then
|
||||||
|
_info "Installing Homebrew (this also installs git via Xcode CLT)..."
|
||||||
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||||
|
echo >> ~/.zprofile
|
||||||
|
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
|
||||||
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
|
_success "Homebrew installed"
|
||||||
|
fi
|
||||||
|
|
||||||
_info "Setting up riotsecure repository..."
|
_info "Setting up riotsecure repository..."
|
||||||
if [ -d ~/riotsecure ]; then
|
if [ -d ~/riotsecure ]; then
|
||||||
_warning "Repository already exists — updating..."
|
_warning "Repository already exists — updating..."
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue