X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=blobdiff_plain;f=switch-mail-host;h=8f0912f7246e1e9fd62af985c8365215f999bda1;hp=a0c590d0ae8b3287715584cda9eaf26119eb8c15;hb=7d5e9e87105fafa2243603f958c8b41cdaa7f0ad;hpb=32a1673064cfd9eaa165b4ea62fa416f02f3dfd2 diff --git a/switch-mail-host b/switch-mail-host index a0c590d..8f0912f 100755 --- a/switch-mail-host +++ b/switch-mail-host @@ -24,7 +24,7 @@ EOF restore_new_btrbk=false restore_old_btrbk=false -cleanup() { +errcatch-cleanup() { if $restore_new_btrbk; then e WARNING: due to failure, btrbk.timer may need manual restoration: e $new_shell sudo systemctl start btrbk.timer @@ -100,12 +100,10 @@ new_hostname=$($new_shell hostname) if $new_shell systemctl is-active btrbk.timer; then m $new_shell sudo systemctl stop btrbk.timer - _errcatch_cleanup=cleanup restore_new_btrbk=true fi if $old_shell systemctl is-active btrbk.timer; then m $old_shell sudo systemctl stop btrbk.timer - _errcatch_cleanup=cleanup restore_old_btrbk=true fi @@ -150,13 +148,19 @@ EOF # ipv6 i think. +if ! m btrbk-run -v $bbk_args $mp_args; then + ret=$? + err "failed initial btrbk" + exit $ret +fi + m $old_shell /a/exe/primary-setup $new_hostname -if ! m btrbk-run -v $bbk_args $mp_args; then +if ! m btrbk-run -v $bbk_args -m /o; then ret=$? bang="$(printf "$(tput setaf 5)█$(tput sgr0)%.0s" 1 2 3 4 5 6 7)" - e $bang failed btrbk. restoring old host as primary + e $bang failed btrbk of /o. restoring old host as primary m $old_shell /a/exe/primary-setup localhost exit $ret fi