mostly fixes, a few improvements
[distro-setup] / switch-mail-host
index f1cb21272e6a057b41d5e49554b765fc1e98af90..edfc30ac827e7a5ca78443c2c23a4ef44b77c792 100644 (file)
@@ -64,7 +64,7 @@ host2_only=false
 force=false
 force_arg=
 pull_reexec=false
-mp_args="-m /o,/a,/ar,/q,/qd,/qr"
+mp_args="-m /o,/a,/q,/qd,/qr"
 check_installed=false
 orig_args=("$@")
 if ! temp=$(getopt -l check-installed,force,pull-reexec,help afioh "$@"); then
@@ -166,7 +166,7 @@ case $direction in
         /usr/local/{bin/{unsaved-buffers{,.el},switch-mail-host},lib/bash-bear}
       )
       m scp -F $HOME/.ssh/confighome \
-        ${files@/#/root@$old_host:} $tmpd
+        ${files[@]/#/root@$old_host:} $tmpd
       diff=false
       for f in ${files[@]}; do
         if ! diff -q $tmpd/${f##*/} $f; then
@@ -214,7 +214,7 @@ esac
 if $mail_only; then
   mp_args="-m /o"
 elif $host2_only; then
-  mp_args="-m /a,/ar,/q,/qd,/qr"
+  mp_args="-m /a,/q,/qd,/qr"
 fi
 
 if ! $force; then
@@ -344,15 +344,18 @@ fi
 e Running main btrbk
 m btrbk-run -v --fast $bbk_args $force_arg $incremental_arg -m /o || ret=$?
 if (( ret )); then
-  bang="$(printf "$(tput setaf 5)█$(tput sgr0)%.0s" 1 2 3 4 5 6 7)"
+  bang="███████"
   e $bang failed btrbk of /o. restoring old host as primary
-  m $old_shell /a/exe/primary-setup localhost
+  if ! m $old_shell /a/exe/primary-setup localhost; then
+    die due to failed btrbk of /o, we tried to restore old host as primary, but then we failed at that too. To resolve: Fix & rerun switch-mail-host, or fix and rerun primary-setup localhost on old shell so you have a working mail server and then rerun switch-mail-host.
+  fi
+  e finished restoring old host as primary, now exiting $ret due to earlier failed btrbk of /o.
   exit $ret
 fi
 
 # new system is usable at this point
 blocks=██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
-printf "%s\n" "$(tput setaf 5 2>/dev/null ||:)${blocks:0:${COLUMNS:-180}}$(tput sgr0 2>/dev/null||:)"
+printf "%s\n" "${blocks:0:${COLUMNS:-100}}"
 
 # once I accidentally accepted incoming mail on old host. I used this script to copy over that mail:
 #