-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·112 lines (95 loc) · 2.22 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/bin/bash
set -eo pipefail
copy() {
local src=$1
local dest=$2
local path=${dest%/*}
mkdir -p "${path}"
echo "Copying $src to $dest"
cp -r "${src}" "${dest}"
}
template() {
local src=$1
local dest=$2
local path=${dest%/*}
mkdir -p "${path}"
echo "Rendering template $src to $dest"
envsubst < "${src}" > "${dest}"
}
copy_all() {
copy bashrc "$HOME/.bashrc"
copy bin "$HOME/bin"
copy init.vim "$HOME/.config/nvim/init.vim"
copy zshrc "$HOME/.zshrc"
copy gh_config.yml "$HOME/.config/gh/config.yml"
}
copy_mac() {
copy zshrc.mac "$HOME/.zshrc.mac"
copy settings.json "$HOME/Library/Application Support/Code/User/settings.json"
copy iterm2profile.plist "$HOME/Library/Application Support/iTerm2/DynamicProfiles/default.plist"
}
copy_linux() {
copy xinitrc "$HOME/.xinitrc"
copy xmobarrc "$HOME/.xmobarrc"
copy xresources "$HOME/.Xresources"
copy zshrc.linux "$HOME/.zshrc.linux"
}
template_all() {
template gitconfig "$HOME/.gitconfig"
}
template_linux() {
template xmonad.hs "$HOME/.xmonad/xmonad.hs"
}
# OS detection
if [ -d /proc ]; then
OS="linux"
fi
if [ -f /System/Library/Kernels/kernel ]; then
OS="mac"
fi
# Install OS specific dependencies and files/templates
case $OS in
linux)
./linux_depends.sh
copy_linux
template_linux
;;
mac)
./mac_depends.sh
copy_mac
;;
esac
# Install multi-platform files/templates
copy_all
template_all
# Silence MOTD
touch $HOME/.hushlogin
# Configure vim
PLUG_VIM="${HOME}/.local/share/nvim/site/autoload/plug.vim"
if [ ! -f "${PLUG_VIM}" ]; then
curl -fLso "${PLUG_VIM}" --create-dirs \
"https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim"
fi
nvim +PlugInstall +qall
nvim +GoInstallBinaries +qall
# Install oh-my-zsh
OH_MY_ZSH_DIR="${HOME}/.oh-my-zsh"
if [ ! -d $OH_MY_ZSH_DIR ]; then
git clone "https://github.com/josephglanville/oh-my-zsh" "${OH_MY_ZSH_DIR}"
else
(cd "${OH_MY_ZSH_DIR}"; git fetch && git reset --hard origin/master)
fi
# Configure Visual Studio Code
EXTENSIONS="
heptio.jsonnet
mathiasfrohlich.kotlin
mauve.terraform
ms-python.python
ms-vscode.go
zhuangtongfa.material-theme
"
for e in $EXTENSIONS; do
code --install-extension $e
done
# Install Python packages
./python_depends.sh