-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·65 lines (56 loc) · 1.08 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
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
#!/bin/bash
# bootstrap.sh
dir=~/.dotfiles
bash_files=".bash_logout .bash_profile .bash_colors .bash_prompt "
git_files=".git_completion .gitignore_global .git_prompt .gitconfig "
vim_files=".vim .vimrc "
files=""
git=""
function usage {
echo "USAGE: $0"
echo
echo "-b : include .bash*"
echo "-g : include .git*"
echo "-v : include .vim*"
exit
}
function git_config {
git config --global user.name "${gitu}"
git config --global user.email "${gite}"
}
if [ "$1" = "" ]
then
usage
fi
while getopts gbv flag
do
case ${flag} in
b)
files+=$bash_files
;;
g)
files+=$git_files
echo -n "Enter your Git username: "
read gitu
echo -n "Enter your Git email: "
read gite
git=1
;;
v)
files+=$vim_files
;;
?)
usage
;;
esac
done
for file in $files
do
# if file exists
mv ~/$file $dir/old_dots/.
ln -s $dir/$file ~/$file
done
if [ "${git}" = 1 ]
then
git_config
fi