fixes and some improvements
[distro-setup] / switch-mail-host
index 08e74fc443f771edcbd625547f9eb796b9c08b70..4a7ce3744a9cd3e20f81aa087fedf4bef26e927a 100644 (file)
@@ -196,7 +196,7 @@ e "On $new_host: umounting /m and /o, checking emacs"
   cat <<'EOF'
 set -eE
 if pgrep -G iank -u iank -f 'emacs --daemon' &>/dev/null; then
-  bufs="$(sudo -u iank emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//')"
+  bufs="$(sudo -u iank env XDG_RUNTIME_DIR=/run/user/1000 emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//')"
   if [[ $bufs ]]; then
     echo "error: on $HOSTNAME, unsaved emacs files: $bufs" >&2
     exit 1
@@ -217,7 +217,7 @@ EOF
 
 $old_shell bash -s <<'EOF'
 if pgrep -G iank -u iank -f 'emacs --daemon' &>/dev/null; then
-  bufs="$(sudo -u iank emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//')"
+  bufs="$(sudo -u iank env XDG_RUNTIME_DIR=/run/user/1000 emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//')"
   if [[ $bufs ]]; then
     echo "error: on $HOSTNAME, unsaved emacs files: $bufs" >&2
     exit 1
@@ -253,7 +253,7 @@ if ! $mail_only; then
 fi
 
 if $host2_only; then
-  if [[ $old_hostname != "$MAIL_HOST" ]]; then
+  if [[ $old_hostname != "$MAIL_HOST" && $old_hostname != kd ]]; then
     m $old_shell systemctl --now disable btrbk.timer
   fi
   m $new_shell systemctl --now enable btrbk.timer