-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
executable file
·102 lines (87 loc) · 3.42 KB
/
deploy.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
#!/bin/bash
#get the directly of where this script is run, and consequently where the files are located
SCRIPTPATH=$( cd $(dirname $0) ; pwd -P )
SYSTEM=${OSTYPE//[0-9.]/}
# Install dependencies
if [[ $SYSTEM == "darwin" ]]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
brew install coreutils findutils gnu-tar gnu-sed gawk gnutls gnu-indent gnu-getopt grep reattach-to-user-namespace vim tmux node ag neovim
fi
# TODO: install tmux from source
#warn if they already have one of the .bak files that exists
if [[ -e ~/.tmux.conf.bak || -e ~/.tmux.reset.conf.bak \
|| -e ~/.tmux.system.conf.bak \
|| -e ~/.zshrc.bak || -e ~/.vimrc.bak \
|| -e ~/.dircolors.bak || -e ~/.vim.bak
|| -e ~/.zsh.bak || -e ~/.gitconfig.bak ]]; then
echo "Warning! one or more *.bak files exist in your home directory that may get overwritten!"
read -p "Continue? [y/n]" yn
while true; do
case $yn in
[Yy]* )
break
;;
[Nn]* )
exit
;;
* )
read -p "Please answer yes or no. [y/n]" yn
;;
esac
done
fi
#git depends on being in directory, so cd to directory first
cd $SCRIPTPATH
function backupIfNotSymlink() {
if [[ -L $1 ]]; then
rm -v "$1"
elif [[ -e $1 ]]; then
mv -v -f "$1" "$1.bak"
fi
}
#remove symlinks if they exist or backup file
backupIfNotSymlink ~/.tmux.conf
backupIfNotSymlink ~/.tmux.reset.conf
backupIfNotSymlink ~/.tmux.system.conf
backupIfNotSymlink ~/.zshrc
backupIfNotSymlink ~/.zshrc.system
backupIfNotSymlink ~/.zshrc.fzf
backupIfNotSymlink ~/.vimrc
backupIfNotSymlink ~/.vimplug
backupIfNotSymlink ~/.dircolors
backupIfNotSymlink ~/.gitconfig
rm -rf ~/.vim.bak
backupIfNotSymlink ~/.vim
backupIfNotSymlink ~/.zsh
backupIfNotSymlink ~/Library/Application\ Support/Code/User/settings.json
backupIfNotSymlink ~/.template.html
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
git clone https://github.com/seebi/dircolors-solarized ~/.dircolors-solarized
git clone https://github.com/glentakahashi/oh-my-zsh.git ~/.oh-my-zsh
git clone https://github.com/jonmosco/kube-ps1.git ~/.kube-ps1
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
curl -fLo ~/.z.sh https://raw.githubusercontent.com/rupa/z/master/z.sh
#make the new symlinks
ln -v -s $SCRIPTPATH/tmux.conf ~/.tmux.conf
ln -v -s $SCRIPTPATH/tmux.reset.conf ~/.tmux.reset.conf
ln -v -s $SCRIPTPATH/vimrc ~/.vimrc
ln -v -s $SCRIPTPATH/vimplug ~/.vimplug
ln -v -s $SCRIPTPATH/zshrc ~/.zshrc
ln -v -s $SCRIPTPATH/zshrc.fzf ~/.zshrc.fzf
ln -v -s ~/.dircolors-solarized/dircolors.ansi-dark ~/.dircolors
ln -v -s $SCRIPTPATH/template.html ~/.template.html
#ln -v -s $SCRIPTPATH/gitconfig ~/.gitconfig
#COPY GITCONFIG BECAUSE IF ITS BROKEN ITS ANNOYING TO MERGE
cp -v $SCRIPTPATH/gitconfig ~/.gitconfig
if [[ $SYSTEM == "darwin" ]]; then
ln -v -s $SCRIPTPATH/vscode.json ~/Library/Application\ Support/Code/User/settings.json
fi
#these two files depend upon system type
ln -s $SCRIPTPATH/$SYSTEM/tmux.system.conf ~/.tmux.system.conf
ln -s $SCRIPTPATH/$SYSTEM/zshrc.system ~/.zshrc.system
#create the local changes files if they don't exist
touch ~/.tmux.local.conf
touch ~/.zshrc.local
touch ~/.vimrc.local
vim +PlugClean +PlugUpdate +qall
#python3 ~/.vim/plugged/YouCompleteMe/install.py