temporarily change backup targets
[distro-setup] / btrbk-run
index 3ec2221d1238b22ab596f71b47e90f54a68365c1..7e66bc22335455c9f77c8cd6fae32032372c5330 100644 (file)
--- a/btrbk-run
+++ b/btrbk-run
@@ -85,6 +85,7 @@ rsync-dirs() {
 }
 
 
+pre="${0##*/}:"
 m() { if $verbose; then printf "$pre %s\n"  "$*"; fi;  "$@"; }
 die() { printf "$pre %s\n" "$*" >&2;  exit 1; }
 
@@ -116,7 +117,6 @@ if [[ -s $default_args_file ]]; then
   sleep 5
 fi
 
-pre="${0##*/}:"
 cron=false
 orig_args=("$@")
 temp=$(getopt -l cron,pull-reexec,help cl:m:npqs:t:vh "$@") || usage 1
@@ -195,7 +195,9 @@ if [[ ! -v targets && ! $source ]]; then
       targets=($home kw)
       ;;
     tp)
-      targets=(frodo kd)
+      # kd disabled temporarily while its hot and i plan to work on it.
+      #targets=(frodo kd)
+      targets=(frodo)
       # might not be connected to the vpn
       if timeout -s 9 10 ssh kw :; then
         targets+=(kw)
@@ -238,8 +240,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