-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
74 lines (64 loc) · 1.29 KB
/
init.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
#!/bin/bash
# Install script for dotfile customizations
# Modified from https://github.com/alexdavid/dotfiles
# Exit on error
set -e
cd
# Backup existing files
backup_dir="dotfiles_backup"
if [ -e $backup_dir ]
then
rm -rf $backup_dir
fi
mkdir $backup_dir
dotfile_dir="dotfiles"
if [ -e $dotfile_dir ]
then
rm -rf $dotfile_dir
fi
mkdir $dotfile_dir
echo -e "Looking for files that would be overwritten."
for i in \
".bash"\
".bashrc"\
".git"\
".gitconfig"\
".vimrc"\
".vim"\
".tmux.conf"\
".vim_settings"
do
if [ -e "$i" ]
then
echo -e "Moving $i to $backup_dir/$i"
mv $i "$backup_dir/$i"
fi
done
# Move into the dotfiles directory to keep it compartmentalized
cd $dotfile_dir
# Pull down repo
if [[ $(git config --get remote.origin.url) != "git://github.com/GLips/dotfiles.git" ]]
then
git init
git remote add origin [email protected]:GLips/dotfiles.git
git fetch
git branch master origin/master
git checkout master
else
git fetch
fi
touch .gitignore
echo "README.md" >> .gitignore
echo "init.sh" >> .gitignore
cd ..
for f in $dotfile_dir/.*
do
b=$(basename $f)
if [ $b != ".git" ] && [ $b != ".gitignore" ] && [ $b != ".." ] && [ $b != "." ]
then
ln -fs $f $b
fi
done
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
vim +BundleInstall +qall
source ~/.bashrc