forked from jhamrick/emacs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·48 lines (42 loc) · 1.1 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
#!/usr/bin/env bash
# Based on bootstrap.sh by Mathias Bynens, retrieved 04/28/2013:
# https://github.com/mathiasbynens/dotfiles/blob/5d1850e041f955c48f5a2241faabddd7af895b58/bootstrap.sh
cd "$(dirname "${BASH_SOURCE}")"
git pull origin master
gitExitCode=$?
if [[ $gitExitCode != 0 ]]; then
exit $gitExitCode
fi
function clean() {
git clean -nx
read -p "Clean the above files? (y/n) " -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
git clean -fx
fi
}
function doIt() {
for i in $(ls -a); do
if [ $i != '.' -a $i != '..' -a $i != '.git' -a $i != '.DS_Store' -a $i != 'bootstrap.sh' -a $i != 'README.md' -a $i != '.gitignore' -a $i != '.gitmodules' ]; then
if [ $(uname) == "Darwin" ]; then
echo "$i"
gcp -alrf "$i" "$HOME/"
else
echo "$i"
cp -alrf "$i" "$HOME/"
fi
fi
done
}
clean
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
if [[ $REPLY =~ ^[Yy]$ ]]; then
doIt
fi
fi
unset clean
unset doIt