-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdotsSync
executable file
·52 lines (49 loc) · 1.61 KB
/
dotsSync
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
#!/usr/bin/env bash
privateRepo=""
publicRepo=""
[ -z "$privateRepo" ] && printf "\nprivateRepo variable missing.\nEdit dotsSync script and add 'privateRepo' variable\n\n" && exit 1
[ -z "$publicRepo" ] && printf "\npublicRepo variable missing.\nEdit dotsSync script and add 'publicRepo' variable\n\n" && exit 1
case "${@}" in
"dry")
rsync -n -av --delete \
--exclude='.git' \
--exclude='.gitignore' \
--exclude='*config/git' \
--exclude='.gitlab' \
--exclude='.github' \
--exclude='.ssh' \
--exclude='*okular*' \
--exclude='bin/dots*' \
"${privateRepo}"/.[^.]* "${publicRepo}"/
rsync -n -av --delete \
--exclude='/README.md' \
--exclude='/LICENSE' \
--exclude='/COPYING' \
--exclude='/Notes' \
--exclude='*okular*' \
"${privateRepo}"/* "${publicRepo}"/
exit 0 ;;
"sync")
rsync -av --delete \
--exclude='.git' \
--exclude='.gitignore' \
--exclude='*config/git' \
--exclude='.gitlab' \
--exclude='.github' \
--exclude='.ssh' \
--exclude='*okular*' \
--exclude='bin/dots*' \
"${privateRepo}"/.[^.]* "${publicRepo}"/
rsync -av --delete \
--exclude='/README.md' \
--exclude='/LICENSE' \
--exclude='/COPYING' \
--exclude='/Notes' \
--exclude='*okular*' \
"${privateRepo}"/* "${publicRepo}"/
exit 0 ;;
*)
echo "Run 'dotsSync sync' to sync between source(privateRepo) and destination(publicRepo)"
echo "Run 'dotsSync dry' for dry-run of sync (no changes) between source(privateRepo) and destination(publicRepo)"
exit 1 ;;
esac