X-Git-Url: https://iankelling.org/git/?a=blobdiff_plain;f=switch-mail-host;h=f1cb21272e6a057b41d5e49554b765fc1e98af90;hb=21bddd1d26a0349f3932f12c65fbc0775e855880;hp=3a362c3b5ace6bc2409d8226c75e684b459c5a1c;hpb=768363d8771edb9d9ed82425fa772d77b90139c0;p=distro-setup diff --git a/switch-mail-host b/switch-mail-host index 3a362c3..f1cb212 100644 --- a/switch-mail-host +++ b/switch-mail-host @@ -1,6 +1,6 @@ #!/bin/bash -source /usr/local/lib/err +set -e; . /usr/local/lib/bash-bear; set +e usage() { cat </dev/null; then - 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 - fi -fi -EOF + cat /usr/local/bin/unsaved-buffers if ! $host2_only; then cat </dev/null; then - 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 - fi -fi + cat /usr/local/bin/unsaved-buffers - <<'EOF' | $old_shell bash -s # Try to prevent emacs from saving stale data it has in memory to disk. eg: files, recentf list, etc. # But if emacs ignores the signal, let it live. -killall -q emacs ||: +pkill -xf 'emacs( --daemon| -f znc-all)' ||: if [[ -e /p/profanity-here ]]; then systemctl disable --now profanity