-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·36 lines (31 loc) · 1.21 KB
/
bootstrap.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
#!/bin/bash
cd "$(dirname "$0")"
git pull
function doIt() {
[ ! -d ~/.vim ] && mkdir ~/.vim
[ ! -d ~/Projects ] && mkdir ~/Projects
rsync --exclude ".git/" --exclude ".DS_Store" --exclude "bootstrap.sh" --exclude "README.md" -av . ~
if [ ! -f ~/.git_extra ]; then
echo "Creating .git_extra\n"
read -p "Enter your name: " name
read -p "Enter your email address used to identify the version control: " email
echo '# Git credentials' >> ~/.git_extra
echo "GIT_AUTHOR_NAME='$name'">> ~/.git_extra
echo 'GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"' >> ~/.git_extra
echo 'git config --global user.name "$GIT_AUTHOR_NAME"' >> ~/.git_extra
echo "GIT_AUTHOR_EMAIL='$email'" >> ~/.git_extra
echo 'GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"' >> ~/.git_extra
echo 'git config --global user.email "$GIT_AUTHOR_EMAIL"' >> ~/.git_extra
echo 'git config --global core.editor "s -w"' >> ~/.git_extra
echo 'git config --global color.ui true' >> ~/.git_extra
fi
}
if [ "$1" == "--force" -o "$1" == "-f" ]; then
doIt
else
read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1
echo
[[ $REPLY =~ ^[Yy]$ ]] && doIt
fi
unset doIt
source ~/.bash_profile