X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=btrbk-run;h=f6570a167f9cc54cc30b212290ef4997b97509d2;hb=202b0a155c831a43d5128b04497db850c21c8ad2;hp=fa20061128281857e82fcfd444225cb147e4158e;hpb=9d21aed0c95e0c343f2769a724d9dbb220874185;p=distro-setup diff --git a/btrbk-run b/btrbk-run index fa20061..f6570a1 100644 --- a/btrbk-run +++ b/btrbk-run @@ -150,9 +150,18 @@ while true; do esac done -# usefull commands are resume and archive +# only tested commands are resume and archive cmd_arg=${1:-run} +case $cmd_arg in + run|resume|archive) : ;; + *) die "untested command arg" ;; +esac + +if (( $# > 1 )); then + die: "only 1 nonoption arg is supported" +fi + if [[ -v targets && $source ]]; then die "error: -t and -s are mutually exclusive" fi @@ -229,8 +238,17 @@ else # ;; *) prospective_mps=(/a /q) - if [[ $HOSTNAME == "$MAIL_HOST" ]]; then - prospective_mps+=(/o) + if [[ $source ]]; then + source_state="$(ssh $source cat /a/bin/bash_unpublished/source-state)" + eval "$source_state" + source_host="$(ssh $source cat /etc/hostname)" + if [[ $source_host == "$MAIL_HOST" ]]; then + prospective_mps+=(/o) + fi + else + if [[ $HOSTNAME == "$MAIL_HOST" ]]; then + prospective_mps+=(/o) + fi fi ;; esac