-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_dotfiles.sh
executable file
·54 lines (44 loc) · 1.23 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
# Check that the directory isn't already a Git repository.
if [[ -d ~/.git ]]; then
echo "It looks like you already have a Git repo in your home directory. Fix that in order to continue."
exit
fi
# Check that we can back up to dotfiles.old
if [[ -d ~/dotfiles.old ]]; then
echo "You already have a dotfiles.old directory, so I can't back up there. You'll have to move that."
exit
fi
# Check that Git and Curl are installed.
hash git 2> /dev/null || {
echo "Oh dear. I require Git, but it's not installed."
exit
}
hash curl 2> /dev/null || {
echo "Oh dear. I require curl, but it's not installed."
exit
}
# Let the fun begin.
echo
echo "Initializing repository..."
git init
echo
echo "Adding remote origin..."
git remote add origin https://github.com/mikewadsten/dotfiles
git fetch
echo
echo "Backing up old dotfiles..."
mkdir dotfiles.old
git ls-tree --name-only origin/master | xargs mv -t dotfiles.old/ > /dev/null 2>&1
echo
echo "Previous dotfiles can be found in dotfiles.old directory."
echo
echo "Checking out remote branch..."
git checkout master
echo
echo "Adding submodules..."
git submodule init
git submodule update
echo
echo "Bootstrapping vim-renaissance"
bash vim-renaissance/bootstrap.sh
echo "All done!"