move some stuff to frodo, rename user to iank, fixes
[distro-setup] / btrbk-run
index 47138209f716975aede08790862bf7bd1035f734..d05616a8861f14c914ce491a7f74460687c060eb 100755 (executable)
--- a/btrbk-run
+++ b/btrbk-run
@@ -30,7 +30,6 @@ script_dir=$(dirname $(readlink -f "$BASH_SOURCE"))
 # note p/m is owned 1000:1000 and chmod 700
 
 
-targets=()
 mountpoints=()
 
 rsync_mountpoint=/q
@@ -50,6 +49,7 @@ temp=$(getopt -l help cl:m:nprt:vh "$@") || usage 1
 eval set -- "$temp"
 while true; do
     case $1 in
+        # only creates the config file, does not run btrbk
         -c) conf_only=true; shift ;;
         -l) rate_limit=$2; shift 2 ;;
         -m) IFS=, mountpoints=($2); unset IFS; shift 2 ;;
@@ -57,6 +57,8 @@ while true; do
         -p) progress_arg="--progress"; shift ;;
         # btrbk arg: Resume only. Skips snapshot creation.
         -r) resume_arg=-r; shift ;;
+        # empty is valid for just doing local snapshot. we have default hosts
+        # we will populate
         -t) IFS=, targets=($2); unset IFS; shift 2 ;;
         -v) verbose=true; verbose_arg=-v; shift ;;
         -h|--help) usage ;;
@@ -74,7 +76,7 @@ fi
 echo -e "$0: options: conf_only=$conf_only\ndry_run=$dry_run\nresume_arg=$resume_arg\nrate_limit=$rate_limit\nverbose=$verbose"
 
 # set default targets
-if ! (( ${#targets[@]} )); then
+if [[ ! -v targets ]]; then
     case $HOSTNAME in
         x2)
             if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
@@ -89,6 +91,9 @@ if ! (( ${#targets[@]} )); then
                 fi
             fi
             ;;
+        frodo)
+            targets=()
+            ;;
         *)
             echo "$0: error: no default targets for this host, use -t"
             exit 1
@@ -108,15 +113,14 @@ if (( ${#mountpoints[@]} )); then
         fi
     done
 else # set default mountpoints
-    prospective_mps=(/a /q)
-    if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
-        prospective_mps+=(/o)
-    fi
-    for tg in ${targets[@]}; do
-        if [[ $tg == frodo && $HOSTNAME == treetowl ]]; then
-            prospective_mps+=(/i)
+    if [[ $HOSTNAME == frodo ]]; then
+        prospective_mps=(/i)
+    else
+        prospective_mps=(/a /q)
+        if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
+            prospective_mps+=(/o)
         fi
-    done
+    fi
     for mp in ${prospective_mps[@]}; do # default mountpoints to sync
         if [[ -e /nocow/btrfs-stale/$mp ]]; then
             echo "$0: warning: $mp stale, not adding to default mountpoints"