-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·147 lines (128 loc) · 3.69 KB
/
install.sh
File metadata and controls
executable file
·147 lines (128 loc) · 3.69 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
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/usr/bin/env bash
# I thought about using puppet or chef or something, but that seems like
# an insanely heavy dependency for something this small.
PICK_VER=4.0.0
mkdir -p logs
green(){
printf "\e[0;32m$@\e[0m\n"
}
cyan(){
printf "\e[0;36m$@\e[0m\n"
}
cyanbold(){
printf "\e[1;36m$@\e[0m\n"
}
red(){
printf "\e[0;31m$@\e[0m\n"
}
shopt -s dotglob
cyanbold "Installing dotfiles"
for f in rcs/*
do
f=$(basename $f)
cyan " - Installing $f"
if [ -s ~/$f ]; then
if [ -h ~/$f ]; then
cyan " - Found ~/$f linked already. Skipping."
continue
fi
if [ -s ~/$f.local ]; then
red " - Could not install $f; ~/$f and ~/$f.local found"
continue
else
mv -n ~/$f ~/$f.local
fi
# TODO: maybe prompt to move?
cyan " - Moved existing file ~/$f to ~/$f.local"
fi
ln -s $(pwd)/rcs/$f ~/$f
green " - Successfully installed $f"
done
# couple additional ones that aren't in $(HOME)
mkdir -p ~/.config/nvim
mkdir -p ~/.config/tmux-powerline/themes
mkdir -p ~/.config/tmux-powerline/segments
declare -A special_symlinks=( [~/.config/nvim/init.vim]=~/.vimrc, [~/.config/nvim/coc-settings.json]=$(pwd)/rcs_special/coc-settings.json, [~/.config/tmux-powerline/config.sh]=$(pwd)/rcs_special/tmux-powerline-config.sh [~/.config/tmux-powerline/themes/hatcrab.sh]=$(pwd)/rcs_special/hatcrab-theme.sh, [~/.config/tmux-powerline/segments/ssid.sh]=$(pwd)/rcs_special/tmux-ssid.sh, [~/.config/ghostty/config.ghostty]=$(pwd)/rcs_special/config.ghostty )
for f in ${!special_symlinks[@]}; do
cyan " - Installing $f"
if [ -s $f ]; then
if [ -h $f ]; then
cyan " - Found $f linked already. Skipping."
continue
fi
if [ -s $f.local ]; then
red " - Could not install $f; $f and $f.local found"
continue
fi
# TODO: maybe prompt to move?
mv -n $f $f.local
cyan " - Moved existing file $f to $f.local"
fi
ln -s ${special_symlinks[$f]} $f
green " - Successfully installed $f"
done
root_dir=$(pwd)
cyanbold "Installing extra lib files"
for f in lib/*
do
f=$(basename $f)
cyan " - Installing $f"
if [ -s ~/lib/$f ]; then
if [ -h ~/lib/$f ]; then
cyan " - Found ~/lib/$f linked already. Skipping."
continue
fi
if [ -s ~/lib/$f.local ]; then
red " - Could not install $f; ~/lib/$f and ~/lib/$f.local found"
continue
else
mv -n ~/lib/$f ~/lib/$f.local
fi
# TODO: maybe prompt to move?
cyan " - Moved existing file ~/lib/$f to ~/lib/$f.local"
fi
ln -s $(pwd)/lib/$f ~/lib/$f
green " - Successfully installed $f"
done
which git > /dev/null
if [ $? -ne 0 ]; then
red "git not installed, exiting"
exit 1
fi
echo
# TODO: fzf, direnv
cyanbold "Installing utilities"
mkdir -p ~/lib
mkdir -p ~/bin
if [ `uname -s` == "Darwin" ]; then
source mac-utils.sh
else
source linux-utils.sh
fi
echo
cyan "Installing zgen"
if [ -s ~/.zgen ]; then
cyan " - zgen found"
else
git clone https://github.com/tarjoilija/zgen.git "${HOME}/.zgen"
fi
cyanbold "Installing vim plugins"
if [ -s ~/.vim/bundle/Vundle.vim ]; then
cyan " - Vundle found"
else
cyan " - Installing Vundle"
mkdir -p ~/.vim/bundle
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
fi
vim +BundleInstall +qall
echo
cyanbold "Installing tpm"
if [ -s ~/.tmux/plugins/tpm ]; then
cyan " - TPM found"
else
cyan " - Installing TPM"
mkdir -p ~/.tmux/plugins
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
fi
echo
green "All done!"