-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathinstall.sh
executable file
·68 lines (55 loc) · 1.75 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
#!/bin/bash
############################
# This script creates symlinks from the home directory to any desired dotfiles in ~/.dotfiles
############################
########## Variables
# Dotfiles directory
dir=~/.dotfiles
# Old dotfiles backup directory
olddir=~/dotfiles_old
# List of files/folders to symlink in homedir
files="bashrc aliases env vimrc tmux.conf ripgreprc gitconfig gitignore_global"
NORMAL=$(tput sgr0)
RED=$(tput setaf 1)
CYAN=$(tput setaf 6)
##########
# create dotfiles_old in homedir
echo -e "$CYAN Creating $olddir for backup of any existing dotfiles in ~ $NORMAL"
if [ -d $olddir ]; then
echo -e "$RED $olddir already exists. Delete it? $NORMAL \c"
read -p "" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
echo -e "\n$CYAN Removing $olddir $NORMAL"
rm -rf $olddir
fi
printf "\n"
fi
mkdir -p $olddir
# move any existing dotfiles in homedir to old dotfiles directory, then create symlinks from the homedir to any files in the dotfiles directory specified in $files
cd $dir
echo -e "$CYAN Moving any existing dotfiles from ~ to $olddir $NORMAL"
for file in $files; do
mv ~/.$file $olddir 2>/dev/null
echo -e "$CYAN Creating symlink to $file in home directory $NORMAL"
ln -s $dir/$file ~/.$file
done
#also move vim folder just in case, no need to link
mv ~/.vim $olddir 2>/dev/null
# make sure a local rc file exists
touch ~/.local_shellrc
#install vim files
echo -e "$CYAN Installing vim plugins (takes a few seconds) $NORMAL"
vim +VundleInstall +qall
clear
# ask to install oh-my-zsh
echo -e "$RED Install zsh-prezto? (Make sure to install zsh first) $NORMAL \c"
read -p "" -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
printf "\n"
bash prezto_install.sh
else
printf "\n"
fi
echo -e "\n$CYAN Finished! $NORMAL"