-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartup.sh
More file actions
executable file
·78 lines (62 loc) · 1.95 KB
/
startup.sh
File metadata and controls
executable file
·78 lines (62 loc) · 1.95 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
#!/bin/bash
function CheckAndCreateFiles {
CONFIG_FILE="$1"
echo "Processing $CONFIG_FILE..."
if [ -f ~/$CONFIG_FILE ]
then
# If actual file was found, copy it to dotfiles dir and back it up
cp ~/$CONFIG_FILE ~/dotfiles/backups/.backup$CONFIG_FILE
# If symbolic link is found, remove the link
if [ -h ~/$CONFIG_FILE ]
then
if unlink ~/$CONFIG_FILE ; then echo "Successfully unlinked $CONFIG_FILE"; fi
fi
# Remove config file from home dir
rm ~/$CONFIG_FILE
fi
# Create symlink between home dir config file and dotfiles config file
if ln -sf ~/dotfiles/$CONFIG_FILE ~/$CONFIG_FILE
then echo "Created link: $CONFIG_FILE" source $CONFIG_FILE
else echo "Link creation failed: $CONFIG_FILE" ;
fi
echo "-----------------"
}
function InstallVundle {
echo 'Checking Vundle installation...'
if [ -d ~/.vim/bundle/Vundle.vim ]
then
echo 'Vundle is already installed on system'
echo '';
MoveColors
echo `vim +PluginInstall +qall`
return 1;
else
if [ `which git` ]
then
echo 'Found git.'
echo `git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim`
echo "-----------------"
echo "Successfully cloned vundle repo"
MoveColors
echo `vim +PluginInstall +qall`
echo 'Successfully installed plugins'
return 0;
else
echo 'Could not find git. Please install git'
exit 1;
fi
fi
}
function MoveColors {
echo 'Moving colors directory...'
cp -R ~/dotfiles/colors ~/.vim/colors
if [ -d ~/.vim/colors ] ; then echo 'Copied colors successfully' ; else echo 'Failed on copying colors' ; fi
echo "-----------------"
}
FILES=('.bash_profile' '.vimrc' '.gitconfig' '.tmux.conf', '.zshrc')
echo " "
InstallVundle
for i in "${FILES[@]}"
do
CheckAndCreateFiles $i
done