-
Notifications
You must be signed in to change notification settings - Fork 3
/
install.sh
62 lines (56 loc) · 1010 Bytes
/
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
#!/bin/bash
# Desc : Deploy dotfiles from repository to home dir.
# Author: Vivien Didelot aka v0n
REPLACE_ALL=false
function Overwrite {
rm -rf $2
ln -sv $1 $2
}
function Deploy {
if test -e $2 ; then
if $REPLACE_ALL ; then
Overwrite $1 $2
else
read -p "Overwrite $2? [y/N/a] " QUESTION
case $QUESTION in
'y')
Overwrite $1 $2
;;
a)
REPLACE_ALL=true
Overwrite $1 $2
;;
*)
echo "skipped $2"
;;
esac
fi
else
read -p "Create $2? [y/N] " QUESTION
case $QUESTION in
'y')
test -d `dirname $2` || mkdir -p `dirname $2`
ln -sv $1 $2
;;
*)
echo "skipped $2"
;;
esac
fi
}
for FILE in * ; do
SRC=`pwd`/$FILE
LINK=$HOME/.$FILE
case $FILE in
$0|README.markdown)
;; # ignore
bin)
LINK=$HOME/$FILE
Deploy $SRC $LINK
;;
*)
Deploy $SRC $LINK
;;
esac
done
exit