-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.sh
More file actions
executable file
·50 lines (40 loc) · 978 Bytes
/
bootstrap.sh
File metadata and controls
executable file
·50 lines (40 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export DOTFILES_DIR="${DOTFILES_DIR:-$SCRIPT_DIR}"
set_brew_env() {
if command -v brew >/dev/null 2>&1; then
eval "$(brew shellenv)"
return 0
fi
if [ -x /opt/homebrew/bin/brew ]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
elif [ -x /usr/local/bin/brew ]; then
eval "$(/usr/local/bin/brew shellenv)"
fi
}
ensure_brew() {
if command -v brew >/dev/null 2>&1; then
set_brew_env
return 0
fi
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
set_brew_env
if ! command -v brew >/dev/null 2>&1; then
echo "Homebrew installation succeeded, but brew is not available on PATH."
exit 1
fi
}
ensure_just() {
if command -v just >/dev/null 2>&1; then
return 0
fi
brew install just
}
main() {
cd "$SCRIPT_DIR"
ensure_brew
ensure_just
just fresh-install
}
main "$@"