-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·135 lines (120 loc) · 5.34 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/bash
# Author: Justyn Shull < justyn [at] justynshull.com >
# Last Updated: 07/15/2012
#
# Script to link my dot files and configs to where they belong
. bash/colors
#Check and see if these commands exist on the system
reqcommands="vim git python ruby screen tmux mutt pyflakes hg ack ag ctags flake8 go zsh bat editorconfig"
for com in $reqcommands;
do
hash ${com} 2>&- || echo -e >&2 "${RedF}${com}${reset}: not installed"
done
dotdir=$(pwd)
ignore="README.md .git install.sh bin update.sh misc .config tags"
for file in *;
do
if [[ "$ignore" =~ "$file" ]]; then
# ignore file
echo -n
else
if [ -f $HOME/.$file ] && [ ! -L $HOME/.$file ]; then
echo -e "${RedF}$file${reset}: Exists but not a symlink. You should backup and delete(or move) it."
continue
fi
if [ -h $HOME/.$file ]; then
echo -e "${GreenF}.$file${reset}: symlink exists"
else
if [ -d $HOME/.$file ]; then
echo -e "${RedF}.$file${reset}: is a directory. You should backup and delete(or move) it."
else
echo -e "${YellowF}$file${reset}: Linking to ${BoldOn}$HOME/.$file${reset}"
ln -s $dotdir/$file $HOME/.$file
fi
fi
fi
done
#Link files in the ~bin directory
#TODO: make a function instead of copying/pasting the code above :)
ignore="README.md .git install.sh bin"
cd ${dotdir}/bin
mkdir -pv ${HOME}/bin
for file in *;
do
if [[ "$ignore" =~ "$file" ]]; then
# ignore file
echo -n
else
if [ -f $HOME/bin/$file ] && [ ! -L $HOME/bin/$file ]; then
echo -e "${RedF}$file${reset}: Exists but not a symlink. You should backup and delete(or move) it."
continue
fi
if [ -h $HOME/bin/$file ]; then
echo -e "${GreenF}bin/$file${reset}: symlink exists"
else
if [ -d $HOME/bin/$file ]; then
echo -e "${RedF}bin/$file${reset}: is a directory. You should backup and delete(or move) it."
else
echo -e "${YellowF}bin/$file${reset}: Linking to ${BoldOn}$HOME/bin/$file${reset}"
ln -s $dotdir/bin/$file $HOME/bin/$file
fi
fi
fi
done
# Do the same for the config dir
# TODO: This should all really be moved into functions
# TODO: Migrate to ~/.local/bin ?
ignore="README.md .gitkeep"
cd ${dotdir}/config
mkdir -pv ${HOME}/.config
for file in *;
do
if [[ "$ignore" =~ "$file" ]]; then
# ignore file
echo -n
else
if [ -f $HOME/.config/$file ] && [ ! -L $HOME/.config/$file ]; then
echo -e "${RedF}$file${reset}: Exists but not a symlink. You should backup and delete(or move) it."
continue
fi
if [ -h $HOME/.config/$file ]; then
echo -e "${GreenF}.config/$file${reset}: symlink exists"
else
if [ -d $HOME/.config/$file ]; then
echo -e "${RedF}.config/$file${reset}: is a directory. You should backup and delete(or move) it."
else
echo -e "${YellowF}.config/$file${reset}: Linking to ${BoldOn}$HOME/config/$file${reset}"
ln -s $dotdir/config/$file $HOME/.config/$file
fi
fi
fi
done
#echo "Installing youcompleteme for vim"
#cd ~/.vim/bundle/YouCompleteMe
#./install.py --clang-completer --gocode-completer
echo "Installing vim plugins"
vim +PlugInstall +qall
# Install oh-my-zsh and extra plugins/themes
echo "Installing oh-my-zsh and plugins"
# [[ ! -d $HOME/.oh-my-zsh ]] && git clone --depth=1 https://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh
if [[ -d $HOME/.oh-my-zsh ]]; then
[[ ! -d ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom} ]] && mkdir -pv ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/{themes,plugins}
# Install spaceship
[[ ! -d $HOME/.oh-my-zsh/custom/themes/spaceship-prompt ]] \
&& git clone --depth=1 https://github.com/denysdovhan/spaceship-prompt.git $HOME/.oh-my-zsh/custom/themes/spaceship-prompt \
&& ln -sv $HOME/.oh-my-zsh/custom/themes/spaceship-prompt/spaceship.zsh-theme $HOME/.oh-my-zsh/custom/themes/spaceship.zsh-theme
# Install powerline10k
[[ ! -d ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k ]] && git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
[[ ! -d $HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting ]] && git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
[[ ! -d ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/evalcache ]] && git clone https://github.com/mroth/evalcache ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/evalcache
else
echo -e "Run this to install oh-my-zsh: \n sh -c '\$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)'"
fi
if [[ ! -f ~/.gitconfig.local ]]; then
echo -e "${RedF}~/.gitconfig.local${reset}: Doesn't exist. You should create it with something like: \n[user]\n\tname = Justyn Shull\n\temail = [email protected]\n";
else
echo -e "${GreenF}~/.gitconfig.local${reset}: exists"
fi
# I should probably split tasks like this into separate files
# Knife on windows or wsl is super slow, rehash causes it to cache the list of knife sub commands and speeds it up quite a bit
hash knife 2>&- && knife rehash