-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·66 lines (50 loc) · 1.14 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
#!/bin/bash
DST=$HOME
DOTFILES=`readlink -en \`dirname $0\``
if [ -z "$CYGWIN" ]; then
export CYGWIN=winsymlinks:native
fi
lowercase(){
echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
}
show_help() {
echo "$0 [-f] [-h]"
echo " -f Force overwrite"
echo " -h Show this help"
}
force=0
while getopts "h?f" opt; do
case "$opt" in
h|\?)
show_help
exit 0
;;
f) force=1
;;
esac
done
LN="ln -rsT"
[ $force -eq 0 ] || LN="$LN -f"
SYSNAME=`lowercase \`uname\``
case "$SYSNAME" in
cygwin*) SYSNAME=cygwin ;;
esac
[ -d $DST ] || mkdir $DST
for file in $DOTFILES/files/*; do
target=`basename $file`
$LN ${file#$DOTFILES/} $DST/.$target
done
[ -d $DST/bin ] || mkdir $DST/bin
if [ -d $DOTFILES/bin ]; then
for file in `find $DOTFILES/bin -maxdepth 1 -type f -print`; do
target=`basename $file`
$LN ${file#$DOTFILES/} $DST/bin/$target
done
fi
if [ -d $DOTFILES/bin/$SYSNAME ]; then
for file in `find $DOTFILES/bin/$SYSNAME -type f -print`; do
target=`basename $file`
$LN ${file#$DOTFILES/} $DST/bin/$target
done
fi
# vim:ts=2:sw=2:et:tw=0: