Skip to content

Commit 0ee240a

Browse files
committed
feat: bootstrap Xcode CLT and Homebrew on fresh macOS
- install.sh now auto-installs Xcode Command Line Tools if missing - install.sh now auto-installs Homebrew if missing - Fix CLI/GUI package categorization for remote configs - Add IsCaskPackage() helper to lookup package type
1 parent 2110b92 commit 0ee240a

3 files changed

Lines changed: 66 additions & 1 deletion

File tree

internal/config/packages.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,14 @@ func GetAllPackageNames() []string {
6969
}
7070
return names
7171
}
72+
73+
func IsCaskPackage(name string) bool {
74+
for _, cat := range Categories {
75+
for _, pkg := range cat.Packages {
76+
if pkg.Name == name {
77+
return pkg.IsCask
78+
}
79+
}
80+
}
81+
return false
82+
}

internal/installer/installer.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,11 @@ func stepInstallPackages(cfg *config.Config) error {
224224

225225
if cfg.RemoteConfig != nil {
226226
for pkg := range cfg.SelectedPkgs {
227-
caskPkgs = append(caskPkgs, pkg)
227+
if config.IsCaskPackage(pkg) {
228+
caskPkgs = append(caskPkgs, pkg)
229+
} else {
230+
cliPkgs = append(cliPkgs, pkg)
231+
}
228232
}
229233
} else {
230234
for _, cat := range config.Categories {

scripts/install.sh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,51 @@ REPO="openbootdotdev/openboot"
66
BINARY_NAME="openboot"
77
INSTALL_DIR="${OPENBOOT_INSTALL_DIR:-/tmp}"
88

9+
# Bootstrap: Install Xcode Command Line Tools if missing
10+
install_xcode_clt() {
11+
if xcode-select -p &>/dev/null; then
12+
return 0
13+
fi
14+
15+
echo "Installing Xcode Command Line Tools..."
16+
echo "(A dialog may appear - please click 'Install')"
17+
echo ""
18+
19+
# Trigger the install
20+
xcode-select --install 2>/dev/null || true
21+
22+
# Wait for installation to complete
23+
echo "Waiting for Xcode Command Line Tools installation..."
24+
until xcode-select -p &>/dev/null; do
25+
sleep 5
26+
done
27+
echo "Xcode Command Line Tools installed!"
28+
echo ""
29+
}
30+
31+
# Bootstrap: Install Homebrew if missing
32+
install_homebrew() {
33+
if command -v brew &>/dev/null; then
34+
return 0
35+
fi
36+
37+
echo "Installing Homebrew..."
38+
echo ""
39+
40+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
41+
42+
# Add brew to PATH for this session
43+
if [[ $(uname -m) == "arm64" ]]; then
44+
eval "$(/opt/homebrew/bin/brew shellenv)"
45+
else
46+
eval "$(/usr/local/bin/brew shellenv)"
47+
fi
48+
49+
echo ""
50+
echo "Homebrew installed!"
51+
echo ""
52+
}
53+
954
detect_arch() {
1055
local arch
1156
arch=$(uname -m)
@@ -47,6 +92,11 @@ main() {
4792
local os arch url binary_path
4893
os=$(detect_os)
4994
arch=$(detect_arch)
95+
96+
if [[ "$os" == "darwin" ]]; then
97+
install_xcode_clt
98+
install_homebrew
99+
fi
50100
url=$(get_download_url "$os" "$arch")
51101
binary_path="${INSTALL_DIR}/${BINARY_NAME}"
52102

0 commit comments

Comments
 (0)