X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=btrbk-run;h=71b0e6b76c939a2c36f085a93dd947adb0a49029;hb=cca99b5a9d3cf311585a9c37b39698b0febe417c;hp=b753b5d7ec4a3b45598ee51105804ff4555c4edf;hpb=90bd397922e7240c41377e7404f79f190bfbc9d8;p=distro-setup diff --git a/btrbk-run b/btrbk-run index b753b5d..71b0e6b 100644 --- a/btrbk-run +++ b/btrbk-run @@ -35,6 +35,11 @@ EOF exit $1 } +# latest $MAIL_HOST +if [[ -e /b/bash_unpublished/source-semi-priv ]]; then + source /b/bash_unpublished/source-semi-priv +fi + script_dir=$(dirname $(readlink -f "$BASH_SOURCE")) # note q is owned by root:1000 @@ -133,35 +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 -case ${targets[0]} in - kw|kww) - prospective_mps=(/a) - ;; -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[*]}" @@ -268,6 +275,7 @@ fi if $dry_run; then m btrbk -v -n $cmd_arg + exit 0 elif [[ $cmd_arg == archive ]]; then if [[ $source ]]; then m btrbk $verbose_arg $progress_arg $cmd_arg ssh://$source$vol $vol @@ -298,11 +306,11 @@ if mountpoint $rsync_mountpoint >/dev/null; then done fi -PATH=$script_dir:$PATH +/a/bin/distro-setup/install-my-scripts if [[ $source ]]; then m mount-latest-subvol else - m mount-latest-remote ${targets[@]} + m /a/exe/mount-latest-remote ${targets[@]} fi # todo: move variable data we don't care about backing up