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