X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=myunison;h=506e9c6237cc0857ed662678efc2f6fc8f0f7696;hb=0b6d44c7f3d567e0a26138509c8a24cb57c69b50;hp=8e3c8b3eceac9352c5867affd32a69810cd8e1b5;hpb=a5733de73429a1f477b83fe59ba8e7c43ce111b6;p=distro-setup diff --git a/myunison b/myunison index 8e3c8b3..506e9c6 100755 --- a/myunison +++ b/myunison @@ -1,17 +1,21 @@ -#!/bin/bash -l +#!/bin/bash -lx set -eE -o pipefail trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR -set -x + +# note, we could have done machine specific subvols, +# but there were so few files, it just didn't seem +# necessary to have an rw copy on those machines +# which did not have the whole p subvol. gen_args=() -do_snapshot=true +do_snapshot=false batch=false while [[ $1 ]]; do case $1 in -ob) gen_args+=(--ours -b); batch=true; shift ;; -b) gen_args+=(-b); batch=true; shift ;; - -n) do_snapshot=false; shift ;; + -n) do_snapshot=true; shift ;; -h|--help) echo "$0: help is head of $BASH_SOURCE:" head -n 30 "$BASH_SOURCE" @@ -26,6 +30,10 @@ if [[ ! $host ]]; then host=$1 fi +if [[ $host == demohost ]]; then + do_snapshot=false +fi + # arch and debian don't play nice with unison. # "connection lost" on unison-gtk, with bignum errs in term, # and simply freezing on cli, all means compiled under @@ -53,7 +61,7 @@ if [[ ! -e $push_path ]]; then fi # note, i'd prefer to use /usr/local/bin, but it's not in arch's default # path for root. -scp /usr/bin/unison-latest-stable root@$host:/usr/bin/unison +rsync -L /usr/bin/unison-latest-stable root@$host:/usr/bin/unison if $do_snapshot; then unison-snapshot @@ -75,12 +83,12 @@ else type -t $f &>/dev/null || f=unison-gtk2 # for arch fi -if s $f "$host"; then +if s $f "$host"; then if [[ $host == frodo ]]; then # only send data to the machine i do full backups to - p=/q/p/c/machine_specific/$HOSTNAME/.unison/ + p=/p/c/machine_specific/$HOSTNAME/.unison/ s rsync -rlptgohi $p root@$host:$p fi - p=/q/p/c/machine_specific/$host/.unison/ + p=/p/c/machine_specific/$host/.unison/ s rsync -rlptgohvi root@$host:$p $p fi