bash-bear rename and a few improvements
[distro-setup] / btrbk-run
index 18eca15d4dfa4518a54f0ab3f0112e40c0b60206..5ce774b7e83c84270ad228479e5ba7b0f1901c40 100644 (file)
--- a/btrbk-run
+++ b/btrbk-run
@@ -22,7 +22,7 @@
 
 [[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
 
-source /usr/local/lib/err
+set -e; . /usr/local/lib/bash-bear; set +e
 
 usage() {
   cat <<'EOF'
@@ -259,7 +259,7 @@ if ! $force && { $check_installed || [[ ! $source ]]; } ; then
       uninstalled-file-die $f
     fi
   done
-  if ! diff -q /a/bin/errhandle/err /usr/local/lib/err; then
+  if ! diff -q /a/bin/bash-bear-trap/bash-bear /usr/local/lib/bash-bear; then
     uninstalled-file-die err
   fi
   if $check_installed; then
@@ -502,7 +502,7 @@ done
 if ! $pull_reexec && [[ $source ]] && $pulla ; then
   tmpf=$(mktemp)
   m rsync -ra $source:/usr/local/bin/{mount-latest-subvol,check-subvol-stale} /usr/local/bin
-  m rsync -ra $source:/usr/local/lib/err /usr/local/lib
+  m rsync -ra $source:/usr/local/lib/bash-bear /usr/local/lib
   m scp $source:/a/bin/distro-setup/btrbk-run $tmpf
   if ! diff -q $tmpf ${BASH_SOURCE[0]}; then
     e "found different version on host $source. reexecing"
@@ -842,11 +842,11 @@ if [[ $ret == 0 ]]; then
     if [[ $h == kd && $HOSTNAME == x3 && $HOSTNAME == "$MAIL_HOST" ]]; then
       m ssh root@$tg 'btrbk-spread-wrap &>/dev/null </dev/null &'
     fi
-    rsync -a -f"- */" -f"+ *" /var/log/btrbk/ root@$tg:/var/log/btrbk/$tg
+    rsync --mkpath -a -f"- */" -f"+ *" /var/log/btrbk/ root@$tg:/var/log/btrbk/$tg
     ssh root@$tg /usr/local/bin/mail-backup-clean
   done
   if [[ $source ]]; then
-    rsync -a -f"- */" -f"+ *" $source:/var/log/btrbk/ /var/log/btrbk/$source
+    rsync --mkpath -a -f"- */" -f"+ *" $source:/var/log/btrbk/ /var/log/btrbk/$source
   fi
 fi