blob: affdf12586f80178b94f19fa5515731c81383544 (
plain) (
blame)
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
67
68
69
70
71
|
#!/bin/bash
set -e
dir="$(cd "$(dirname "$0")" && pwd)"
os=$(uname --operating-system)
CMD=$SYSTEMROOT/System32/cmd.exe
filter() {
fname="files/$(basename "$@")"
if [[ "$fname" == "files/." || "$fname" == "files/.." ]] ; then
return 0
fi
return 1
}
create_windows_link() {
fp=$1
tp=$2
opt=""
if [ -d "$fp" ] ; then
opt="/D"
fi
if [[ 1 = $OVERRIDE ]] ; then
rm --recursive --force "$tp"
else
rm --force "$tp"
fi
$CMD /c mklink $opt $(cygpath --windows "$tp") $(cygpath --windows "$fp") >/dev/null
}
create_link() {
while read fp tp ; do
case "$os" in
"Cygwin") create_windows_link "$fp" "$tp" ;;
*) ln --symbolic --force --no-target-directory "$fp" "$tp" ;;
esac
done
}
after_install() {
mkdir -p $HOME/tmp/vim-undo $HOME/tmp/vim-backup
mkdir -p $HOME/.mutt/cache
touch $HOME/.mutt/aliases
if ! which ctags >/dev/null 2>&1; then
echo 'No ctags.' >&2
fi
cd $HOME/.vim/bundle/Command-T/ruby/command-t && make >/dev/null
}
check_override() {
while read filename ; do
fp=$dir/files/$filename
tp=$HOME/$filename
if [[ 1 != $OVERRIDE ]] ; then
rp=$(readlink -f "$tp")
if [[ -e "$rp" && "$rp" != "$fp" ]] ; then
echo "Skip: $filename" >&2
continue
fi
fi
echo "$fp" "$tp"
done
}
if [[ "-f" = "$1" ]] ; then
OVERRIDE=1
fi
cd && \
( ls --format=single-column --almost-all "$dir/files" | check_override | create_link ) && \
after_install
|