4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
11 -ob) gen_args
+=(--ours -b); batch=true
; shift ;;
12 -b) gen_args
+=(-b); batch=true
; shift ;;
13 -n) do_snapshot
=false
; shift ;;
15 echo "$0: help is head of $BASH_SOURCE:"
16 head -n 30 "$BASH_SOURCE"
20 -*) gen_args
+=($1) ; shift ;;
24 if [[ ! $host ]]; then
28 if [[ $host == demohost
]]; then
32 # arch and debian don't play nice with unison.
33 # "connection lost" on unison-gtk, with bignum errs in term,
34 # and simply freezing on cli, all means compiled under
35 # different ocaml versions.
36 # I had the great realization that unison is a self contained
37 # binary with no special runtime dependencies.
38 # However, I got a gtk error running the ui version.
39 # todo: I should test pushing my unison version instead
41 echo "$0: running: gen ${gen_args[@]}"
42 /p
/c
/subdir_files
/.unison
/gen
${gen_args[@]}
43 if [[ ! $host ]]; then
44 echo "$0: error: expected argument for hostname"
49 # todo: this doesn't deal with if the host is running arch too
51 # debian uses this path, and has gtk version linked as /usr/bin/unison,
52 # but I'd rather not push the gtk version
53 push_path
=/usr
/bin
/unison-latest-stable
54 if [[ ! -e $push_path ]]; then
55 push_path
=/usr
/bin
/unison
57 # note, i'd prefer to use /usr/local/bin, but it's not in arch's default
59 scp
/usr
/bin
/unison-latest-stable root@
$host:/usr
/bin
/unison
63 if ! ssh root@
$host "! type unison-snapshot || unison-snapshot"; then
64 if [[ ! ${gen_args[@]} ]]; then
65 # gen_args are all about syncing with new systems where
66 # we could expect the remote snapshot to not be available yet.
67 echo "$0: error: failed remote unison-snapshot"
74 # todo, figure out what the cli version is called in non-debian distros
75 f
=unison-latest-stable
78 type -t $f &>/dev
/null || f
=unison-gtk2
# for arch
82 if [[ $host == frodo
]]; then
83 # only send data to the machine i do full backups to
84 p
=/q
/p
/c
/machine_specific
/$HOSTNAME/.unison
/
85 s rsync
-rlptgohi $p root@
$host:$p
87 p
=/q
/p
/c
/machine_specific
/$host/.unison
/
88 s rsync
-rlptgohvi root@
$host:$p $p