make btrbk-run -pv be default
authorIan Kelling <iank@fsf.org>
Sat, 30 Mar 2019 19:05:55 +0000 (15:05 -0400)
committerIan Kelling <iank@fsf.org>
Sat, 30 Mar 2019 19:05:55 +0000 (15:05 -0400)
btrbk-run

index 87f55811f6bf8af08fddfeba5306d8efff4e16ac..0c8dd8b40600052da4a88b696dd0b484740a1e23 100755 (executable)
--- a/btrbk-run
+++ b/btrbk-run
@@ -22,6 +22,10 @@ trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
 [[ $EUID == 0 ]] || exec sudo -E "$BASH_SOURCE" "$@"
 
 usage() {
+  cat <<'EOF'
+btrbk-run [OPTIONS]
+usually -t TARGET_HOST
+EOF
   echo "top of script file:"
   sed -n '1,/^[# ]*end command line/{p;b};q' "$0"
   exit $1
@@ -37,10 +41,14 @@ mountpoints=()
 
 rsync_mountpoint=/q
 
+# default options
 conf_only=false
 dry_run=false # mostly for testing
 rate_limit=no
-verbose=false
+verbose=true
+if [[ $- == *i* ]]; then
+  progress_arg="--progress"
+fi
 
 default_args_file=/etc/btrbk-run.conf
 if [[ -s $default_args_file ]]; then
@@ -59,6 +67,7 @@ while true; do
     -m) IFS=, mountpoints=($2); unset IFS; shift 2 ;;
     -n) dry_run=true; dry_run_arg=-n; shift ;;
     -p) progress_arg="--progress"; shift ;;
+    -q) verbose=false; verbose_arg=; progress_arg=; shift ;;
     # target hosts to send to. empty is valid for just doing local
     # snapshot. we have default hosts we will populate.
     -t) IFS=, targets=($2); unset IFS; shift 2 ;;