-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·67 lines (53 loc) · 2.01 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
#!/bin/bash
################################################################################
# This script installs the dotfiles into the users home dir
# 1. Backs up existing dotfiles
# 2. Creates symlinks from dotfiles to the home directory
# 3. Creates private .gitconfig and .hgrc files
################################################################################
dotfilesdir=dotfiles
backupdir=$HOME/dotfiles_old
echo " - Creating $backupdir for backup of any existing dotfiles in $HOME"
mkdir -p $backupdir
for file in `git ls-tree -r master --name-only`; do
if [[ "$file" != "README.md" && "$file" != "install.sh" ]]; then
if [ -e $HOME/$file ]; then
echo " - Moving $file to $backupdir/$file"
mv $HOME/$file $backupdir/
fi
echo " - Creating symlink to $file in home directory."
cp --parents $file $HOME
ln -sf $HOME/$dotfilesdir/$file $HOME/$file
fi
done
# Create a .gitconfig.private file if it doesn't exist
privategit=$HOME/.gitconfig.private
if [ ! -f $privategit ]; then
echo -e "\n - Setting up $privategit"
echo -n " - What is your email? "
read gitemail
echo -n " - What is your full name? "
read gitname
echo -e "[user]\n\temail = $gitemail\n\tname = $gitname" > $privategit
fi
# Create a .hgrc.private file if it doesn't exist
privatehg=$HOME/.hgrc.private
if [ ! -f $privatehg ]; then
echo -e "\n - Setting up $privatehg"
read -p " - Are you using the same name and email address for mercurial as well? (y/n) "
if [ "$REPLY" == "y" ]
then
hgrcemail=$gitemail
hgrcname=$gitname
else
echo -n " - What is your email? "
read hgrcemail
echo -n " - What is your full name? "
read hgrcname
fi
echo -e "[ui]\nusername = $hgrcname <$hgrcemail>" > $privatehg
fi
# Finally install vundle before we run vim for the first time
if [ ! -e ~/.vim/bundle/Vundle.vim ]; then
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
fi