4 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
6 # note, we could have done machine specific subvols,
7 # but there were so few files, it just didn't seem
8 # necessary to have an rw copy on those machines
9 # which did not have the whole p subvol.
16 -ob) gen_args
+=(--ours -b); batch=true
; shift ;;
17 -b) gen_args
+=(-b); batch=true
; shift ;;
18 -n) do_snapshot
=true
; shift ;;
20 echo "$0: help is head of $BASH_SOURCE:"
21 head -n 30 "$BASH_SOURCE"
25 -*) gen_args
+=($1) ; shift ;;
29 if [[ ! $host ]]; then
33 if [[ $host == demohost
]]; then
37 # arch and debian don't play nice with unison.
38 # "connection lost" on unison-gtk, with bignum errs in term,
39 # and simply freezing on cli, all means compiled under
40 # different ocaml versions.
41 # I had the great realization that unison is a self contained
42 # binary with no special runtime dependencies.
43 # However, I got a gtk error running the ui version.
44 # todo: I should test pushing my unison version instead
46 echo "$0: running: gen ${gen_args[@]}"
47 /p
/c
/subdir_files
/.unison
/gen
${gen_args[@]}
48 if [[ ! $host ]]; then
49 echo "$0: error: expected argument for hostname"
54 # todo: this doesn't deal with if the host is running arch too
56 # debian uses this path, and has gtk version linked as /usr/bin/unison,
57 # but I'd rather not push the gtk version
58 push_path
=/usr
/bin
/unison-latest-stable
59 if [[ ! -e $push_path ]]; then
60 push_path
=/usr
/bin
/unison
62 # note, i'd prefer to use /usr/local/bin, but it's not in arch's default
64 rsync
-L /usr
/bin
/unison-latest-stable root@
$host:/usr
/bin
/unison
68 if ! ssh root@
$host "! type unison-snapshot || unison-snapshot"; then
69 if [[ ! ${gen_args[@]} ]]; then
70 # gen_args are all about syncing with new systems where
71 # we could expect the remote snapshot to not be available yet.
72 echo "$0: error: failed remote unison-snapshot"
79 # todo, figure out what the cli version is called in non-debian distros
80 f
=unison-latest-stable
83 type -t $f &>/dev
/null || f
=unison-gtk2
# for arch
87 if [[ $host == frodo
]]; then
88 # only send data to the machine i do full backups to
89 p
=/p
/c
/machine_specific
/$HOSTNAME/.unison
/
90 s rsync
-rlptgohi $p root@
$host:$p
92 p
=/p
/c
/machine_specific
/$host/.unison
/
93 s rsync
-rlptgohvi root@
$host:$p $p