-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·62 lines (49 loc) · 1.04 KB
/
install.sh
File metadata and controls
executable file
·62 lines (49 loc) · 1.04 KB
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
#!/usr/bin/env bash
function link_file {
source="${PWD}/$1"
target="${HOME}/${1/_/.}"
if [ -L "${target}" ]; then
unlink $target
fi
if [ -e "${target}" ] && [ ! -L "${target}" ]; then
mv $target $target.bak
fi
ln -sf ${source} ${target}
}
function unlink_file {
source="${PWD}/$1"
target="${HOME}/${1/_/.}"
if [ -e "${target}.bak" ] && [ -L "${target}" ]; then
unlink ${target}
mv $target.bak $target
fi
}
function link_dir {
source="${PWD}/$1"
target="${HOME}/${1/_/.}"
ln -sf ${source}/* ${target}
}
function download_vim {
curl https://raw.githubusercontent.com/Shougo/neobundle.vim/master/bin/install.sh | sh
}
function deploy {
for i in _*; do
if [ -d "$i" ]; then
link_dir "$i"
else
link_file "$i"
fi
done
}
function undeploy {
for i in _*; do
unlink_file "$i"
done
}
if [ "$1" == "deploy" ]; then
deploy
download_vim
fi
if [ "$1" == "undeploy" ]; then
undeploy
fi