-
Notifications
You must be signed in to change notification settings - Fork 7
/
install_dotfiles.sh
60 lines (47 loc) · 1.33 KB
/
install_dotfiles.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
if [[ -d ~/.git ]]; then
echo "Oh my. It looks like you already have a Git repository in your home directory. You'll need to fix this before you install the dotfiles."
exit
fi
if [[ -d ~/dotfiles.old ]]; then
echo "Well, I was going to put all your old files into dotfiles.old, but it appears you already have a directory named that. Move it and try again... Please?"
exit
fi
hash git 2> /dev/null || {
echo "Oh dear. I require Git, but it's not installed."
exit
}
echo
echo "Initializing a blank repo..."
git init
echo
echo "Adding dotfiles remote origin...."
git remote add origin https://github.com/jdavis/dotfiles.git
echo
echo "Fetching code..."
git fetch
echo
echo "Moving old dotfiles so we don't have a clash..."
mkdir dotfiles.old
git ls-tree --name-only origin/master | xargs mv '{}' dotfiles.old/ > /dev/null 2>&1
echo
echo "Checking out remote branch..."
git checkout -b master remotes/origin/master
echo
echo "Setting up submodules..."
git submodule init
git submodule update
builtin cd ~/.vim
git submodule init
git submodule update
echo
echo
echo "All old dotfiles were moved to dotfiles.old."
echo
echo
echo "To install Vundle Bundles, run the command below:"
echo " vim +BundleInstall +qall"
echo
echo
echo "Dotfiles are now installed. Proceed to conquer the universe."
/usr/bin/env zsh
source ~/.zshrc