-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
47 lines (40 loc) · 1.13 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
#!/usr/bin/env sh
info() {
printf '%s\n' "Info: $1"
}
clone_dir="${XDG_DATA_HOME:-$HOME/.local/share}/basalt/source"
if [ -d "$clone_dir" ]; then
printf '%s\n' "Warn: Basalt already installed to '$clone_dir'" >&2
exit 0
fi
if git clone 'https://github.com/hyperupcall/basalt' "$clone_dir"; then :; else
printf '%s\n' "Error: Could not clone Git repository (code $?)" >&2
exit 1
fi
bashrc="$HOME/.bashrc"
if [ -f "$bashrc" ]; then
info "Appending to $bashrc"
cat >> "$bashrc" <<-"EOF"
# Basalt
export PATH="${XDG_DATA_HOME:-$HOME/.local/share}/basalt/source/pkg/bin:$PATH"
eval "$(basalt global init bash)"
EOF
fi
zshrc="${ZDOTDIR:-$HOME}/.zshrc"
if [ -f "$zshrc" ]; then
info "Appending to $zshrc"
cat >> "$zshrc" <<-"EOF"
# Basalt
export PATH="${XDG_DATA_HOME:-$HOME/.local/share}/basalt/source/pkg/bin:$PATH"
eval "$(basalt global init zsh)"
EOF
fi
fishrc="${XDG_CONFIG_HOME:-$HOME/.config}/fish/config.fish"
if [ -f "$fishrc" ]; then
info "Appending to $fishrc"
cat >> "$fishrc" <<-"EOF"
# Basalt
set -gx PATH "${XDG_DATA_HOME:-$HOME/.local/share}/basalt/source/pkg/bin" $PATH
source (basalt global init fish | psub)
EOF
fi