-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·51 lines (37 loc) · 1.02 KB
/
install.sh
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
#!/usr/bin/env zsh
if [ -z "${ZSH_VERSION:-}" ]; then
abort "ZShell is required to interpret this script."
fi
abort() {
printf "%s\n" "$@"
exit 1
}
command_exists() {
command -v $@ >/dev/null 2>&1
}
if [[ "$OSTYPE" == "darwin"* ]]; then
if ! command_exists brew; then
abort "On macOS, you'll need to install Homebrew first."
fi
fi
if ! command_exists git; then
abort "Git is required to interpret this script."
fi
SCRIPTPATH="${0:a:h}"
echo "== Update git submodules =="
git -C "$SCRIPTPATH" submodule update --init
if [ -z "$SKIP_PACKAGES" ]; then
echo "== Install packages =="
if command_exists brew; then
brew install $(cat "$SCRIPTPATH"/packages{,.homebrew}.list)
elif command_exists apt-get; then
sudo apt-get install -y $(cat "$SCRIPTPATH"/packages{,.apt-get}.list)
else
abort "Don't know how to install packages on this platform. Aborting..."
fi
fi
mkdir -p "$HOME"/bin
# Allow modules to hook into install
for file in "$SCRIPTPATH"/modules/*/install.sh; do
source "$file"
done