X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=blobdiff_plain;f=switch-mail-host;h=df0b83605ee25fc8c7743504d18a5698278a2916;hp=b0b35a612a8e42decdd2f23f5bd387f2dbaa1db2;hb=HEAD;hpb=50f25d1eec109c4596cfc638c9a7c98da0f0b5d0 diff --git a/switch-mail-host b/switch-mail-host index b0b35a6..053134a 100644 --- a/switch-mail-host +++ b/switch-mail-host @@ -134,6 +134,26 @@ source /a/bin/bash_unpublished/source-state direction=$1 host=$2 +case $script_name in + switch-mail-host) + if [[ $MAIL_HOST != "$HOST2" ]]; then + mail_only=true + fi + ;; + switch-host2) + host2_only=true + ;; + *) + err unexpected script name + ;; +esac + +if $mail_only; then + mp_args="-m /o" +elif $host2_only; then + mp_args="-m /a,/q,/qd,/qr" +fi + if ! $force && { $check_installed || [[ $direction == push ]]; } ; then install_bin_files=( @@ -196,7 +216,7 @@ case $direction in fi done if $diff; then - e "found different version on old_host=$old_hostname, reexecing" + e "found different version on old_host=$old_host, reexecing" m /usr/local/bin/switch-mail-host --pull-reexec "${orig_args[@]}" exit 0 fi @@ -218,25 +238,6 @@ case $direction in ;; esac -case $script_name in - switch-mail-host) - if [[ $MAIL_HOST != "$HOST2" ]]; then - mail_only=true - fi - ;; - switch-host2) - host2_only=true - ;; - *) - err unexpected script name - ;; -esac - -if $mail_only; then - mp_args="-m /o" -elif $host2_only; then - mp_args="-m /a,/q,/qd,/qr" -fi if ! $force; then if $host2_only; then @@ -288,12 +289,13 @@ while $active; do done done -# ensure these are unused before doing anything -e "On $new_host: umounting /m and /o, checking emacs" -{ - cat /usr/local/bin/unsaved-buffers - if ! $host2_only; then - cat <