-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·77 lines (60 loc) · 2.17 KB
/
bootstrap.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
#!/bin/bash
sudo apt update
BASEDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo $BASEDIR
echo $HOME
######################
## ZSH INSTALLATION ##
######################
# install ZSH
echo "Installing ZSH"
sudo apt install zsh
# make zsh your default shell
chsh -s $(which zsh)
#############################
## CLEAR EXISTING DOTFILES ##
#############################
# if .bashrc already there then copy it to dotfiles/backup
! [ -d $HOME/dotfiles/backups ] && mkdir $HOME/dotfiles/backups
[ -f $HOME/.bashrc ] && cp -f $HOME/.bashrc $HOME/dotfiles/backups/.bashrc && rm -r $HOME/.bashrc
[ -f $HOME/.zshrc ] && rm -r $HOME/.zshrc
[ -d $HOME/.oh-my-zsh ] && rm -rf $HOME/.oh-my-zsh
[ -f $HOME/.tmux.conf ] && rm -r $HOME/.tmux.conf
[ -f $HOME/.vimrc ] && rm -r $HOME/.vimrc
#######################
## SYM-LINK DOTFILES ##
#######################
# bash
echo "Symlink: .bashrc"
ln -s ${BASEDIR}/.bashrc $HOME/.bashrc
# zsh
echo "Symlink: .zshrc"
ln -s ${BASEDIR}/.zshrc $HOME/.zshrc
# oh my zsh
echo "Symlink: .oh-my-zsh"
ln -s ${BASEDIR}/.oh-my-zsh $HOME/.oh-my-zsh
# git
# if .gitconfig already there then leave it alone
echo "Symlink: .gitconfig"
! [ -f $HOME/.gitconfig ] && ln -s ${BASEDIR}/.gitconfig $HOME/.gitconfig
# tmux
echo "Symlink: .tmux.conf"
ln -s ${BASEDIR}/.tmux.conf $HOME/.tmux.conf
# vim
echo "Symlink: .vimrc"
ln -s ${BASEDIR}/.vimrc $HOME/.vimrc
#######################
## OH-MY-ZSH PLUGINS ##
#######################
[ -d $HOME/.oh-my-zsh ] && rm -rf $HOME/.oh-my-zsh && echo "Removed existing ~/.oh-my-zsh dir"
sudo apt install git-core curl fonts-powerline
KEEP_ZSHRC=yes RUNZSH=no sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
! [ -d $HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting ] && \
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git $HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting && \
! [ -d $HOME/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting ] && \
cp -r ${BASEDIR}/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting $HOME/.oh-my-zsh/custom/plugins
# this will answer yes to any installation questions
# https://linux.die.net/man/1/yes
echo "bootstrap complete!"<<-EOF
yes
EOF