minor improvements
[distro-setup] / btrbk-run
index 34b23a8af6a552d79672b55a0dc3b55b5cdc8186..1ca6f57ab2d4092e0b98862caa0f6380113046ab 100644 (file)
--- a/btrbk-run
+++ b/btrbk-run
@@ -474,9 +474,31 @@ log_path=/var/log/btrbk/$(date +%F_%T%:::z).log
 echo copying output to $log_path
 exec &> >(pee cat 'ts "%F %T"|dd of='$log_path' status=none')
 
-
+# print some non-default opts
 if $verbose; then
-  printf " options: conf_only=%s\ndry_run=%s\nrate_limit=%s\nverbose=%s\ncmd_arg=%s\n" "$conf_only" "$dry_run" "$rate_limit" "$verbose" "$cmd_arg"
+  opts_show=()
+  if ! $conf_only; then
+    opts_show+=(conf_only=true)
+  fi
+  if ! $dry_run; then
+    opts_show+=(dry_run=true)
+  fi
+  if [[ $rate_limit != no ]]; then
+    opts_show+=("rate_limit=$rate_limit")
+  fi
+  if [[ $cmd_arg != run ]]; then
+    opts_show+=(cmd_arg=$cmd_arg)
+  fi
+  if (( $opts_show >= 1 )); then
+    first=true
+    for opt in ${opts_show[@]}; do
+      if $first; then
+        printf "%s" "$opt"
+      else
+        printf " %s" "$opt"
+    done
+    echo
+  fi
 fi
 
 if [[ -v targets ]]; then
@@ -490,8 +512,6 @@ fi
 echo "mountpoints: ${mountpoints[*]}"
 
 
-
-
 # pull_reexec stops us from getting into an infinite loop if there is some
 # kind of weird problem
 pulla=false