blob: c0e28bb21322e285728385fe8fe3a29c679c2379 (
plain)
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
|
#!/bin/bash
#
# sync code or home folder across systems
#
BASENAME="`basename $0`"
DEST="$1"
UNISON="unison"
# Use the following config if you need to sync with legacy systems
UNISON="unison-2.32.52"
function sync_code_run {
local config="$1"
if [ -z "$config" ]; then
return
fi
if [ -f "$HOME/.unison/$config.prf" ]; then
echo "Starting sync using $config..."
$UNISON $config
else
echo "Skipping absent profile $config."
return 1
fi
}
if [ ! -z "$DEST" ]; then
profiles=""
if [ "$BASENAME" == "sync-code" ] || [ "$BASENAME" == "sync-all" ]; then
profiles="$profiles $DEST-code"
fi
if [ "$BASENAME" == "sync-irssi" ] || [ "$BASENAME" == "sync-all" ]; then
profiles="$profiles $DEST-irssi"
fi
if [ "$BASENAME" == "sync-irssi-tor" ] || [ "$BASENAME" == "sync-all" ]; then
profiles="$profiles $DEST-irssi-tor"
fi
if [ "$BASENAME" == "sync-home" ] || [ "$BASENAME" == "sync-all" ]; then
profiles="$profiles $DEST-home"
fi
for profile in $profiles; do
sync_code_run $profile
done
fi
|