fix -m option
authorIan Kelling <iank@fsf.org>
Tue, 16 Apr 2019 20:07:42 +0000 (16:07 -0400)
committerIan Kelling <iank@fsf.org>
Tue, 16 Apr 2019 20:07:42 +0000 (16:07 -0400)
btrbk-run

index df17880ed025497749c535431a640797eabf0422..71b0e6b76c939a2c36f085a93dd947adb0a49029 100644 (file)
--- a/btrbk-run
+++ b/btrbk-run
@@ -138,30 +138,37 @@ if [[ $source ]]; then
 fi
 
 
-
-# set default mountpoints
-case $HOSTNAME in
-  # no remote backups atm. note, if we do enable this, configuration below will need some changes.
-  #  frodo)
-  #    prospective_mps=(/i)
-  #    ;;
-  *)
-    prospective_mps=(/a /q)
-    if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
-      prospective_mps+=(/o)
+if [[ $mountpoints ]]; then
+  for mp in ${mountpoints[@]}; do # default mountpoints to sync
+    if [[ -e /nocow/btrfs-stale/$mp ]]; then
+      echo "$0: error: $mp is stale, mount-latest-subvol first"
+      exit 1
     fi
-    ;;
-esac
-
-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"
-    continue
-  fi
-  if awk '{print $2}' /etc/fstab | grep -xF $mp &>/dev/null; then
-    mountpoints+=($mp)
-  fi
-done
+  done
+else
+  # set default mountpoints
+  case $HOSTNAME in
+    # no remote backups atm. note, if we do enable this, configuration below will need some changes.
+    #  frodo)
+    #    prospective_mps=(/i)
+    #    ;;
+    *)
+      prospective_mps=(/a /q)
+      if [[ $HOSTNAME == "$MAIL_HOST" ]]; then
+        prospective_mps+=(/o)
+      fi
+      ;;
+  esac
+  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"
+      continue
+    fi
+    if awk '{print $2}' /etc/fstab | grep -xF $mp &>/dev/null; then
+      mountpoints+=($mp)
+    fi
+  done
+fi
 
 echo "mountpoints: ${mountpoints[*]}"