From: Ian Kelling Date: Tue, 16 Apr 2019 20:07:42 +0000 (-0400) Subject: fix -m option X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=commitdiff_plain;h=cca99b5a9d3cf311585a9c37b39698b0febe417c fix -m option --- diff --git a/btrbk-run b/btrbk-run index df17880..71b0e6b 100644 --- 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[*]}"