Repository navigation
Expand file tree
/
Copy pathinstall
More file actions
executable file
·64 lines (49 loc) · 1.35 KB
/
Copy pathinstall
File metadata and controls
executable file
·64 lines (49 loc) · 1.35 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
set -euo pipefail
CONFIG="install.conf.yaml"
DOTBOT_DIR="dotbot"
DOTBOT_BIN="bin/dotbot"
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
find_brew() {
if command -v brew >/dev/null 2>&1; then
command -v brew
return 0
fi
if [[ -x /opt/homebrew/bin/brew ]]; then
echo /opt/homebrew/bin/brew
return 0
fi
if [[ -x /usr/local/bin/brew ]]; then
echo /usr/local/bin/brew
return 0
fi
return 1
}
bootstrap_macos() {
[[ "$(uname -s)" == "Darwin" ]] || return 0
if ! xcode-select -p >/dev/null 2>&1; then
echo "Installing Xcode Command Line Tools..."
xcode-select --install
echo "Finish installing Xcode Command Line Tools, then re-run ./install."
exit 1
fi
local brew_bin=""
if brew_bin="$(find_brew)"; then
eval "$("${brew_bin}" shellenv)"
return 0
fi
if [[ -z "${brew_bin}" ]]; then
echo "Installing Homebrew..."
NONINTERACTIVE=1 /bin/bash -c \
"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
brew_bin="$(find_brew)"
if [[ -n "${brew_bin}" ]]; then
eval "$("${brew_bin}" shellenv)"
fi
}
bootstrap_macos
cd "${BASEDIR}"
git -C "${DOTBOT_DIR}" submodule sync --quiet --recursive
git submodule update --init --recursive "${DOTBOT_DIR}"
"${BASEDIR}/${DOTBOT_DIR}/${DOTBOT_BIN}" -d "${BASEDIR}" -c "${CONFIG}" "$@"