[[ $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
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
-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 ;;