Skip to content

Commit 7105778

Browse files
committed
Make setup script more agnostic.
1 parent 5955715 commit 7105778

1 file changed

Lines changed: 22 additions & 21 deletions

File tree

certifiable-build/scripts/setup.sh

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,32 @@ set -eu
33

44
OS="$(uname -s)"
55

6-
case "$OS" in
7-
Linux)
8-
;;
9-
Darwin)
10-
;;
11-
*)
12-
echo "Unsupported OS: $OS"
13-
exit 1
14-
;;
15-
esac
16-
176
if command -v brew >/dev/null 2>&1; then
187
echo "Homebrew already installed."
198
else
20-
echo "Installing Homebrew..."
21-
229
NONINTERACTIVE=1 /bin/bash -c \
2310
"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
24-
fi
2511

26-
if ! command -v brew >/dev/null 2>&1; then
27-
if [ -x /home/linuxbrew/.linuxbrew/bin/brew ]; then
28-
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
29-
else
30-
echo "brew installed but not found on PATH"
31-
exit 1
32-
fi
12+
case "$OS" in
13+
Linux)
14+
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
15+
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
16+
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bashrc
17+
;;
18+
Darwin)
19+
if [ -x /opt/homebrew/bin/brew ]; then
20+
eval "$(/opt/homebrew/bin/brew shellenv)"
21+
return 0
22+
elif [ -x /usr/local/bin/brew ]; then
23+
eval "$(/usr/local/bin/brew shellenv)"
24+
return 0
25+
fi
26+
;;
27+
*)
28+
echo "Unsupported OS: $OS"
29+
exit 1
30+
;;
31+
esac
3332
fi
3433

3534
echo "Homebrew version:"
@@ -38,4 +37,6 @@ brew --version
3837
brew update
3938
brew install build2
4039

40+
bdep --version
41+
4142
echo "System dependencies installed successfully."

0 commit comments

Comments
 (0)