forked from driesvints/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap-common
executable file
·48 lines (40 loc) · 1.42 KB
/
bootstrap-common
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
#!/usr/bin/env bash
cd "$(dirname "$0")"
source ./helpers/runtime.sh
source ../bin/helpers/trap_and_trace.sh
log_info "Performing common bootstrapping steps"
ZSH="${ZSH:-${HOME}/.oh-my-zsh}"
ZSH_CUSTOM="${ZSH_CUSTOM:-${ZSH}/custom}"
ZSH_PATH="${ZSH_PATH:-$(command -v zsh 2>/dev/null)}"
log_info "checking for zsh and OMZ"
if [[ -n "${ZSH_PATH}" ]]; then
# Check for Oh My Zsh and install if we don't have it
if [[ ! -d "${ZSH}" ]]; then
log_info "Installing Oh My Zsh"
/usr/bin/env bash -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
fi
mkdir -p "${ZSH_CUSTOM}"
# Set zsh as the default
log_info "Setting ZSH as the default shell"
sudo chsh -s "$(command -v zsh 2>/dev/null)"
fi
# Symlink config files applicable to local and remote development
log_debug "calling config symlink script"
./symlink-config-files
if [[ -n "${ZSH_PATH}" ]] && [[ -d "${ZSH_CUSTOM}" ]]; then
log_debug "Installing OMZ plugins"
mkdir -p "${ZSH_CUSTOM}/plugins"
plugins=(
"zsh-syntax-highlighting"
"zsh-autosuggestions"
"zsh-completions"
"zsh-history-substring-search"
)
for plugin in "${plugins[@]}"; do
if [[ ! -d "${ZSH_CUSTOM}/plugins/${plugin}" ]]; then
log_debug "Installing ${plugin} to ${ZSH_CUSTOM}/plugins"
clone_project "zsh-users/${plugin}" "${ZSH_CUSTOM}/plugins/${plugin}"
fi
done
fi
log_success "Done bootstrapping!"