X-Git-Url: https://iankelling.org/git/?p=distro-setup;a=blobdiff_plain;f=switch-mail-host;h=9ebd2a73cd1e41731e2318eea8cc9369bb9a7375;hp=b67203aabc475608a4768cbcc2204126979ef48b;hb=e2fb88c7f8c32cf6442a399844bd2fbd1c912027;hpb=8826440696abdfbfd6c7f5a40c95163bd489a1b1 diff --git a/switch-mail-host b/switch-mail-host index b67203a..9ebd2a7 100755 --- a/switch-mail-host +++ b/switch-mail-host @@ -107,6 +107,8 @@ while $new_shell $btrbk_test || $old_shell $btrbk_test; do sleep 2 done +new_hostname=$($new_shell hostname) + ########### end initial processing, begin actually modifying things ########## restore_new_btrbk=false @@ -121,10 +123,10 @@ if $old_shell systemctl is-active btrbk.timer; then fi -$new_shell bash -s <<'EOF' +$new_shell bash -xs <<'EOF' set -eE -if mountpoint /m; then sudo umount /m; fi -if mountpoint /o; then sudo umount /o; fi +if mountpoint -q /m; then sudo umount /m; fi +if mountpoint -q /o; then sudo umount /o; fi EOF # if new_host is not on home network, make mail.iankelling.org not resolve @@ -132,17 +134,16 @@ EOF if [[ $new_host == $HOSTNAME ]] && ! $at_home; then echo | $wrt_shell cedit mail_host /etc/hosts || [[ $? == 1 ]] # 1 means file changed. else - $wrt_shell bash -s <