forked from MaskRay/Config
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.bash
More file actions
executable file
·55 lines (47 loc) · 857 Bytes
/
Copy pathdeploy.bash
File metadata and controls
executable file
·55 lines (47 loc) · 857 Bytes
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
#!/bin/bash -e
files=$(git ls-files | egrep -v 'backup|.ssh|proxy.pac.coffee')
target=~
link() {
ln -sf "$PWD/$1" "$2"
}
do_ssh() {
cp -auT home/.ssh ~/.ssh
chmod 700 ~/.ssh
}
do_mkdir() {
mkdir -p ~/{.vimtmp/undo,.history,tmp}
}
do_git() {
git submodule update --init --recursive
}
for f in $files; do
if [[ "$f" =~ ^home/ ]]; then
:
else
continue
fi
echo copying $f
g="$target/${f/home\//}"
mkdir -p "${g%/*}"
if ! [[ -L "$g" ]]; then
if [[ -f "$g" || "$f" -ot "$g" ]]; then
if diff -q "$f" "$g"; then
echo "identical $g"
continue
else
echo "overwrite $g? [yn]"
read option
case $option in
[yY]);;
[nN])
echo "skipping $g"
continue;;
esac
fi
fi
link "$f" "$g"
fi
done
do_ssh
do_mkdir
do_git