From 768363d8771edb9d9ed82425fa772d77b90139c0 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Wed, 4 Oct 2023 21:40:52 -0400 Subject: [PATCH] mostly profanity and fixes --- .bashrc | 10 +- .inputrc | 4 + .screenrc | 3 + brc | 14 +- brc2 | 62 ++++++- btrbk-run | 4 +- distro-end | 16 ++ filesystem/etc/cron.d/ian | 1 + .../etc/systemd/system/profanity.service | 12 ++ i3-sway/i3.conf | 1 + pkgs | 1 + primary-setup | 27 +-- prof | 23 +++ prof-backup | 38 +++++ prof-remote | 25 +++ script-files | 3 + subdir_files/.local/share/konsole/README.ian | 30 +++- .../.local/share/konsole/default.keytab.orig | 156 ++++++++--------- subdir_files/.local/share/konsole/ian.keytab | 158 +++++++++--------- .../.local/share/konsole/profanity.profile | 15 ++ .../.local/share/konsole/profileian.profile | 2 +- switch-mail-host | 27 ++- system-status | 46 ++--- 23 files changed, 462 insertions(+), 216 deletions(-) create mode 100644 filesystem/etc/systemd/system/profanity.service create mode 100755 prof create mode 100755 prof-backup create mode 100755 prof-remote create mode 100644 subdir_files/.local/share/konsole/profanity.profile diff --git a/.bashrc b/.bashrc index 470a1a4..d8cbd97 100644 --- a/.bashrc +++ b/.bashrc @@ -33,10 +33,9 @@ HISTIGNORE='pass *:otp *:oathtool *:histrm *' -#### begin section that works with sl() function to return from -# noninteractive ssh shells, or tty. tty because often i -# use it when something is going and io is slow and my bashrc -# is too slow. +#### if (in +# noninteractive ssh shells or tty). tty because often i use it when +# something is going and io is slow and my bashrc is too slow. if [[ $LC_USEBASHRC != t && ( $SSH_CONNECTION || $TERM == linux ) ]]; then # Here we did not opt-in to running our .bashrc file so we just # return, but we still setup a function to source it without returning @@ -86,6 +85,9 @@ else source $_tmp fi fi + if [[ $IANK_BASHRC_RUN ]]; then + $IANK_BASHRC_RUN ||: + fi ###### End sourcing of files ##### fi #### end section that works with sl() function to return from diff --git a/.inputrc b/.inputrc index c54a4c6..e47d4d9 100644 --- a/.inputrc +++ b/.inputrc @@ -215,3 +215,7 @@ Control-Space: set-mark # cant, and then you can't yank-pop because the cursor is in the wrong spot. # # + +# make ctrl-backspace work, see +# https://unix.stackexchange.com/questions/264791/ctrl-backspace-and-ctrl-delete-in-bash +"\C-h": unix-word-rubout diff --git a/.screenrc b/.screenrc index 27e5cd4..2854fc2 100644 --- a/.screenrc +++ b/.screenrc @@ -48,3 +48,6 @@ defscrollback 1000000 # avoid annoying "New screen..." prompt # https://serverfault.com/questions/377479/can-i-disable-the-message-line-when-launching-screen-rr msgwait 0 + +# starting under systemd for profanity sets term to just screen and then we get no colors +term screen.xterm-256color diff --git a/brc b/brc index 5e8776d..b2df5c2 100644 --- a/brc +++ b/brc @@ -1756,11 +1756,15 @@ nags() { fi /usr/bin/nagstamon & } + +# profanity screen +profsrc() { + screen -RD -S profanity +} + +# i dont want to wait for konsole to exit... prof() { - if ! pgrep -f /usr/bin/dunst >/dev/null; then - /usr/bin/dunst & - fi - profanity "$@" + command prof &>/dev/null & } @@ -2152,7 +2156,7 @@ skgit() { local f for f in $(i s | awk '$1 == "modified:" {print $2}'); do if [[ $(head -n1 "$f") == '#!/bin/bash'* ]]; then - sk $f + sk $f ||: fi done } diff --git a/brc2 b/brc2 index 108be38..bad1194 100644 --- a/brc2 +++ b/brc2 @@ -1673,7 +1673,7 @@ bindpush() { dsign iankelling.org expertpathologyreview.com zroe.org amnimal.ninja lipush for h in li bk; do - m sl $h <<'EOF' + m sl $h.b8.nz <<'EOF' source ~/.bashrc m dnsup EOF @@ -2169,7 +2169,7 @@ hstatus() { wlog() { local day i days_back days_back=${1:-16} - for (( i=0; i=0; i-- )); do day=$( date +%F -d @$((EPOCHSECONDS - 86400*i )) ) date "+%a %b %d" -d @$((EPOCHSECONDS - 86400*i )) | tr '\n' ' ' /a/opt/timetrap/bin/t d -ftotal -s $day -e $day all -m '^w|lunch$' @@ -2780,6 +2780,12 @@ myirc() { } +allmyirc() { + local d + d=/var/lib/znc/moddata/log/iank/freenode + ssh root@iankelling.org "cd $d; find . -mtime -60 -type f -exec grep '\ 15 )); then + i=$(( logcount - 15 )) + else + i=0 + fi + min_date=$(date -d 'monday 2 weeks ago' +%s) + for (( ; i < logcount; i++ )); do + log=${logs[$i]} + d=$(date -d "$(head -n1 $log|awk '{print $1}')" +%s) + if (( d < min_date )); then + continue + fi + if awk '$3 == "iank:"' $log | sed -r 's/^(.{10}).(.{8})[^ ]+(.*)/\1_\2\3/' | grep .; then + hr + fi + done + popd } +# tail pms in the last day, for the case where we restart profanity and +# didn't check for pms beforehand. +profrecent() { + local d dates date files f + # consider making the day count passed by parameter. note: this works: $(date -d '2 day ago' +%Y_%m_%d) + dates=("$(date -d +%Y_%m_%d)" "$(date -d '1 day ago' +%Y_%m_%d)" ) + for d in /d/p/profanity/chatlogs/iank_at_fsf.org/!(rooms); do + files=() + for date in ${dates[@]}; do + f=$d/$date.log + if [[ -e $f ]]; then + files+=($f) + fi + done + if (( ${#files[@]} >= 1 )); then + cat ${files[@]} | tail + hr + fi + done +} + + # usage: debvm DEBIAN_VERSION RAM_MB debvm() { local ver ram fname src diff --git a/btrbk-run b/btrbk-run index 18eca15..c4d8461 100644 --- a/btrbk-run +++ b/btrbk-run @@ -842,11 +842,11 @@ if [[ $ret == 0 ]]; then if [[ $h == kd && $HOSTNAME == x3 && $HOSTNAME == "$MAIL_HOST" ]]; then m ssh root@$tg 'btrbk-spread-wrap &>/dev/null $dir/mailhost.prom < $dir/mailhost.prom <= 1 )); then + remote=$1 +else + remote=b8.nz + if systemctl --quiet is-active profanity || [[ $HOSTNAME == kd ]]; then + dossh=false + fi +fi + +if $dossh; then + # IANK_BASHRC_RUN because if prof-remote dies for some reason, we + # I dont want konsole to disappear. + export IANK_BASHRC_RUN="prof-remote $remote" + konsole --profile profanity +else + konsole --profile profanity -e screen -RD -S profanity +fi diff --git a/prof-backup b/prof-backup new file mode 100755 index 0000000..f5b99bf --- /dev/null +++ b/prof-backup @@ -0,0 +1,38 @@ +#!/bin/bash + +# We setup kd as a server which runs profanity, because profanity +# contains important state which it does not save to disk: the most +# recent read message in each chat room and for private messages. +# To do this, uses data directories in /d/p. + +# However, if we need to take kd down for maintenance, we can run +# profanity on HOST2 with data directory in /p. To do this, stop +# profanity, run prof-backup, and then systemctl start profanity from +# HOST2, and then run prof. To connect from other machines, run prof +# HOST2_SSH_NAME. To have the profanity service stopped and started with +# switch-mail-host, do touch /p/profanity-here. To do the reverse, +# +# systemctl stop profanity +# rsync /p/profanity{,-config} kdwg.b8.nz:/d/p +# ssh root@kdwg.b8.nz systemctl --now enable profanity + +if [ -z "$BASH_VERSION" ]; then echo "error: shell is not bash" >&2; exit 1; fi +source /a/bin/errhandle/err + +source /a/bin/bash_unpublished/source-state +if [[ $HOSTNAME != "$HOST2" ]]; then + exit 0 +fi + +case $HOSTNAME in + kd) + if systemctl --quiet is-active profanity; then + rsync /d/p/profanity{,-config} /p + fi + ;; + *) + if ssh b8.nz systemctl --quiet is-active profanity; then + rsync -a b8.nz:/d/p/profanity{,-config} /p + fi + ;; +esac diff --git a/prof-remote b/prof-remote new file mode 100755 index 0000000..d848894 --- /dev/null +++ b/prof-remote @@ -0,0 +1,25 @@ +#!/bin/bash + + +set -e; . /usr/local/lib/err; set +e + +remote=$1 +fastcon=0 +while true; do + start=$EPOCHSECONDS + ssh -t $remote screen -Dr -S profanity + if (( EPOCHSECONDS > start + 600 )); then + fastcon=0 + fi + # we try to reconnect quickly for a while (just once as I write this), + # then try to reconnect slowly. + if (( fastcon < 1 )); then + echo "waiting 10. any key to cancel" + read -rsN1 -t 10 ||: + fastcon=$((fastcon+1)) + else + echo "waiting 120. any key to cancel" + # like sleep but stop on any input + read -rsN1 -t 120 ||: + fi +done diff --git a/script-files b/script-files index 02ffa3c..ce27dcd 100644 --- a/script-files +++ b/script-files @@ -17,6 +17,9 @@ my_bin_files=( check-crypttab /a/bin/cedit/cedit btrbk-spread-wrap + prof + prof-remote + prof-backup ) for f in /b/log-quiet/*; do diff --git a/subdir_files/.local/share/konsole/README.ian b/subdir_files/.local/share/konsole/README.ian index 622cb12..7ef7188 100644 --- a/subdir_files/.local/share/konsole/README.ian +++ b/subdir_files/.local/share/konsole/README.ian @@ -1,11 +1,29 @@ -I added several things, do a diff with default.orig. -I saved that in case konsole updates the defaults. -key Backspace+Ctrl : "\x17" -it makes ctrl-backspace delete the prev word by making it input C-w. -Note: keybindings name is specified in profile file, filename.keytab, and at the top of that file. +Note: non-keybind konsole profile changes should be manually duplicated +to the profanity profile, which exists to have a color scheme that is +more compatible with profanity: it will show historical PM messages in a +light color instead of an unreadable black. + +To see what changes I made in ian.keytab, do a diff with +default.keytab.orig. (I also sorted the file). Konsole ignores files not +named *.keytab. I changed the name of the in the default keybind profile +file to include trisquel11-iank just to avoid any confusion. The \E[4d etc were found without exaplanation in a random stackoverflow comment. It seems to just be an unused and useful pattern, where d could be any letter. I set them with +AppScreen, but they don't necessarily need to be, its just thats the only place I use them, and maybe more -useful to have the duplicates working outside of emacs. +useful to have the duplicates working outside of emacs. AppScreen +modifier means that the keybind only works within a program like emacs +which takes over scroll back, per +https://docs.kde.org/trunk5/en/konsole/konsole/key-bindings.html. + + +Historical note about change no longer in ian.keytab: +I saved that in case konsole updates the defaults, which +happened. Originally saved in 2019, to fix control-backspace not working +because it wasn't bound to anything, it just emited backspace. I fixed +it by setting it to ^W, because bash binds ^W to unix-word-rubout. But in 2023 I ran profanity which uses +readline, and control-backspace didn't work. Poking around, I figured +out that konsole defaults had been updated to make control-backspace emit ^H, and sakura worked the same, detected by running +running "stty -icanon; cat" per +http://www.linusakesson.net/programming/tty/index.php . So, it seems better to set ^H to unix-word-rubout in .inputrc than change the key in konsole. diff --git a/subdir_files/.local/share/konsole/default.keytab.orig b/subdir_files/.local/share/konsole/default.keytab.orig index 0e09117..8ed1459 100644 --- a/subdir_files/.local/share/konsole/default.keytab.orig +++ b/subdir_files/.local/share/konsole/default.keytab.orig @@ -1,94 +1,100 @@ -keyboard "Default (XFree 4)" -key Left-Shift+KeyPad+Ansi-AppCursorKeys : "\E[D" -key Left-Shift+KeyPad+Ansi+AppCursorKeys : "\EOD" -key Left+Shift+AppScreen : "\E[1;*D" -key Left-Shift+Ansi+AnyModifier : "\E[1;*D" -key Left-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[D" -key Left-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOD" -key Left-Shift-Ansi : "\ED" -key Up+Shift-AppScreen : ScrollLineUp -key Up-Shift+KeyPad+Ansi-AppCursorKeys : "\E[A" -key Up-Shift+KeyPad+Ansi+AppCursorKeys : "\EOA" -key Up+Shift+AppScreen : "\E[1;*A" -key Up-Shift+Ansi+AnyModifier : "\E[1;*A" -key Up-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[A" -key Up-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOA" -key Up-Shift-Ansi : "\EA" -key Home+Shift-AppScreen : ScrollUpToTop -key Home+AnyModifier : "\E[1;*H" -key Home+AppCursorKeys-AnyModifier : "\EOH" -key Home-AppCursorKeys-AnyModifier : "\E[H" -key Home+KeyPad-AppCursorKeys : "\E[H" -key Home+KeyPad+AppCursorKeys : "\EOH" -key End+Shift-AppScreen : ScrollDownToBottom -key End+AnyModifier : "\E[1;*F" -key End+AppCursorKeys-AnyModifier : "\EOF" -key End-AppCursorKeys-AnyModifier : "\E[F" -key End+KeyPad-AppCursorKeys : "\E[F" -key End+KeyPad+AppCursorKeys : "\EOF" -key PgUp+Shift-AppScreen : ScrollPageUp -key PgUp-Shift+AnyModifier : "\E[5;*~" -key PgUp-Shift-AnyModifier : "\E[5~" -key PgUp-Shift+KeyPad : "\E[5~" -key PgDown+Shift-AppScreen : ScrollPageDown -key PgDown-Shift+AnyModifier : "\E[6;*~" -key PgDown-Shift-AnyModifier : "\E[6~" -key PgDown-Shift+KeyPad : "\E[6~" -key Right-Shift+KeyPad+Ansi-AppCursorKeys : "\E[C" -key Right-Shift+KeyPad+Ansi+AppCursorKeys : "\EOC" -key Right+Shift+AppScreen : "\E[1;*C" -key Right-Shift+Ansi+AnyModifier : "\E[1;*C" -key Right-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[C" -key Right-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOC" -key Right-Shift-Ansi : "\EC" -key Down+Shift-AppScreen : ScrollLineDown -key Down-Shift+KeyPad+Ansi-AppCursorKeys : "\E[B" -key Down-Shift+KeyPad+Ansi+AppCursorKeys : "\EOB" -key Down+Shift+AppScreen : "\E[1;*B" -key Down-Shift+Ansi+AnyModifier : "\E[1;*B" -key Down-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[B" -key Down-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOB" -key Down-Shift-Ansi : "\EB" -key Backtab-Ansi : "\t" +keyboard "iank-trisquel11 - Default (XFree 4)" +key Backspace+Ctrl : "\b" +key Backspace-Ctrl : "\x7f" key Backtab+Ansi : "\E[Z" -key Backspace : "\x7f" -key Esc : "\E" -key Tab+Shift-Ansi : "\t" -key Tab+Shift+Ansi : "\E[Z" -key Tab-Shift : "\t" -key Ins+AnyModifier : "\E[2;*~" -key Ins-AnyModifier : "\E[2~" -key Ins+KeyPad : "\E[2~" +key Backtab-Ansi : "\t" +key Backtab+Ctrl+Ansi : "\E[27;6;9~" +key Backtab+Ctrl-Ansi : "\t" +key Clear+KeyPad : "\E[E" key Del+AnyModifier : "\E[3;*~" key Del-AnyModifier : "\E[3~" key Del+KeyPad : "\E[3~" -key Return+Shift : "\EOM" -key Return-Shift+NewLine : "\r\n" -key Return-Shift-NewLine : "\r" +key Down-Shift+Ansi+AnyModifier : "\E[1;*B" +key Down-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[B" +key Down-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOB" +key Down-Shift-Ansi : "\EB" +key Down+Shift+AppScreen : "\E[1;*B" +key Down+Shift-AppScreen : ScrollLineDown +key Down-Shift+KeyPad+Ansi-AppCursorKeys : "\E[B" +key Down-Shift+KeyPad+Ansi+AppCursorKeys : "\EOB" +key End+AnyModifier : "\E[1;*F" +key End-AppCursorKeys-AnyModifier : "\E[F" +key End+AppCursorKeys-AnyModifier : "\EOF" +key End+KeyPad-AppCursorKeys : "\E[F" +key End+KeyPad+AppCursorKeys : "\EOF" +key End+Shift-AppScreen : ScrollDownToBottom key Enter-NewLine : "\r" key Enter+NewLine : "\r\n" +key Esc : "\E" +key F10+AnyModifier : "\E[21;*~" +key F10-AnyModifier : "\E[21~" key F11+AnyModifier : "\E[23;*~" key F11-AnyModifier : "\E[23~" key F12+AnyModifier : "\E[24;*~" key F12-AnyModifier : "\E[24~" -key F9+AnyModifier : "\E[20;*~" -key F9-AnyModifier : "\E[20~" -key F10+AnyModifier : "\E[21;*~" -key F10-AnyModifier : "\E[21~" -key F3+AnyModifier : "\EO*R" -key F3-AnyModifier : "\EOR" -key F4+AnyModifier : "\EO*S" -key F4-AnyModifier : "\EOS" key F1+AnyModifier : "\EO*P" key F1-AnyModifier : "\EOP" key F2+AnyModifier : "\EO*Q" key F2-AnyModifier : "\EOQ" -key F7+AnyModifier : "\E[18;*~" -key F7-AnyModifier : "\E[18~" -key F8+AnyModifier : "\E[19;*~" -key F8-AnyModifier : "\E[19~" +key F3+AnyModifier : "\EO*R" +key F3-AnyModifier : "\EOR" +key F4+AnyModifier : "\EO*S" +key F4-AnyModifier : "\EOS" key F5+AnyModifier : "\E[15;*~" key F5-AnyModifier : "\E[15~" key F6+AnyModifier : "\E[17;*~" key F6-AnyModifier : "\E[17~" +key F7+AnyModifier : "\E[18;*~" +key F7-AnyModifier : "\E[18~" +key F8+AnyModifier : "\E[19;*~" +key F8-AnyModifier : "\E[19~" +key F9+AnyModifier : "\E[20;*~" +key F9-AnyModifier : "\E[20~" +key Home+AnyModifier : "\E[1;*H" +key Home-AppCursorKeys-AnyModifier : "\E[H" +key Home+AppCursorKeys-AnyModifier : "\EOH" +key Home+KeyPad-AppCursorKeys : "\E[H" +key Home+KeyPad+AppCursorKeys : "\EOH" +key Home+Shift-AppScreen : ScrollUpToTop +key Ins+AnyModifier : "\E[2;*~" +key Ins-AnyModifier : "\E[2~" +key Ins+KeyPad : "\E[2~" +key Left-Shift+Ansi+AnyModifier : "\E[1;*D" +key Left-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[D" +key Left-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOD" +key Left-Shift-Ansi : "\ED" +key Left+Shift+AppScreen : "\E[1;*D" +key Left-Shift+KeyPad+Ansi-AppCursorKeys : "\E[D" +key Left-Shift+KeyPad+Ansi+AppCursorKeys : "\EOD" +key PgDown-Shift+AnyModifier : "\E[6;*~" +key PgDown-Shift-AnyModifier : "\E[6~" +key PgDown+Shift-AppScreen : ScrollPageDown +key PgDown-Shift+KeyPad : "\E[6~" +key PgUp-Shift+AnyModifier : "\E[5;*~" +key PgUp-Shift-AnyModifier : "\E[5~" +key PgUp+Shift-AppScreen : ScrollPageUp +key PgUp-Shift+KeyPad : "\E[5~" +key Return+Shift : "\EOM" +key Return-Shift-NewLine : "\r" +key Return-Shift+NewLine : "\r\n" +key Right-Shift+Ansi+AnyModifier : "\E[1;*C" +key Right-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[C" +key Right-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOC" +key Right-Shift-Ansi : "\EC" +key Right+Shift+AppScreen : "\E[1;*C" +key Right-Shift+KeyPad+Ansi-AppCursorKeys : "\E[C" +key Right-Shift+KeyPad+Ansi+AppCursorKeys : "\EOC" key Space+Ctrl : "\x00" +key Tab+Ctrl+Ansi : "\E[27;5;9~" +key Tab+Ctrl-Ansi : "\t" +key Tab+Shift+Ansi : "\E[Z" +key Tab+Shift-Ansi : "\t" +key Tab-Shift : "\t" +key Up-Shift+Ansi+AnyModifier : "\E[1;*A" +key Up-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[A" +key Up-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOA" +key Up-Shift-Ansi : "\EA" +key Up+Shift+AppScreen : "\E[1;*A" +key Up+Shift-AppScreen : ScrollLineUp +key Up-Shift+KeyPad+Ansi-AppCursorKeys : "\E[A" +key Up-Shift+KeyPad+Ansi+AppCursorKeys : "\EOA" diff --git a/subdir_files/.local/share/konsole/ian.keytab b/subdir_files/.local/share/konsole/ian.keytab index 64e9c2b..efcb6f8 100644 --- a/subdir_files/.local/share/konsole/ian.keytab +++ b/subdir_files/.local/share/konsole/ian.keytab @@ -1,99 +1,103 @@ keyboard "ian" -key F7+AnyModifier : "\E[18;*~" -key F7-AnyModifier : "\E[18~" -key F8+AnyModifier : "\E[19;*~" -key F8-AnyModifier : "\E[19~" -key F5+AnyModifier : "\E[15;*~" -key F5-AnyModifier : "\E[15~" -key F6+AnyModifier : "\E[17;*~" -key F6-AnyModifier : "\E[17~" -key F3+AnyModifier : "\EO*R" -key F3-AnyModifier : "\EOR" -key F4+AnyModifier : "\EO*S" -key F4-AnyModifier : "\EOS" -key F1+AnyModifier : "\EO*P" -key F1-AnyModifier : "\EOP" -key F2+AnyModifier : "\EO*Q" -key F2-AnyModifier : "\EOQ" +key Backspace+Ctrl : "\b" +key Backspace-Ctrl : "\x7f" +key Backtab+Ansi : "\E[Z" +key Backtab-Ansi : "\t" +key Backtab+Ctrl+Ansi : "\E[27;6;9~" +key Backtab+Ctrl-Ansi : "\t" +key Clear+KeyPad : "\E[E" +key .+Ctrl+AppScreen : "\E[4c" +key Del+AnyModifier : "\E[3;*~" +key Del-AnyModifier : "\E[3~" +key Del+KeyPad : "\E[3~" +key Down-Shift+Ansi+AnyModifier : "\E[1;*B" +key Down-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[B" +key Down-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOB" +key Down-Shift-Ansi : "\EB" +key Down+Shift+AppScreen : "\E[1;*B" +key Down+Shift-AppScreen : ScrollLineDown +key Down-Shift+KeyPad+Ansi-AppCursorKeys : "\E[B" +key Down-Shift+KeyPad+Ansi+AppCursorKeys : "\EOB" +key End+AnyModifier : "\E[1;*F" +key End-AppCursorKeys-AnyModifier : "\E[F" +key End+AppCursorKeys-AnyModifier : "\EOF" +key End+KeyPad-AppCursorKeys : "\E[F" +key End+KeyPad+AppCursorKeys : "\EOF" +key End+Shift-AppScreen : ScrollDownToBottom +key Enter-NewLine : "\r" +key Enter+NewLine : "\r\n" +key Esc : "\E" +key F10+AnyModifier : "\E[21;*~" +key F10-AnyModifier : "\E[21~" key F11+AnyModifier : "\E[23;*~" key F11-AnyModifier : "\E[23~" key F12+AnyModifier : "\E[24;*~" key F12-AnyModifier : "\E[24~" +key F1+AnyModifier : "\EO*P" +key F1-AnyModifier : "\EOP" +key F2+AnyModifier : "\EO*Q" +key F2-AnyModifier : "\EOQ" +key F3+AnyModifier : "\EO*R" +key F3-AnyModifier : "\EOR" +key F4+AnyModifier : "\EO*S" +key F4-AnyModifier : "\EOS" +key F5+AnyModifier : "\E[15;*~" +key F5-AnyModifier : "\E[15~" +key F6+AnyModifier : "\E[17;*~" +key F6-AnyModifier : "\E[17~" +key F7+AnyModifier : "\E[18;*~" +key F7-AnyModifier : "\E[18~" +key F8+AnyModifier : "\E[19;*~" +key F8-AnyModifier : "\E[19~" key F9+AnyModifier : "\E[20;*~" key F9-AnyModifier : "\E[20~" -key F10+AnyModifier : "\E[21;*~" -key F10-AnyModifier : "\E[21~" +key Home+AnyModifier : "\E[1;*H" +key Home-AppCursorKeys-AnyModifier : "\E[H" +key Home+AppCursorKeys-AnyModifier : "\EOH" +key Home+KeyPad-AppCursorKeys : "\E[H" +key Home+KeyPad+AppCursorKeys : "\EOH" +key Home+Shift-AppScreen : ScrollUpToTop +key I+Ctrl+AppScreen : "\E[4d" key Ins+AnyModifier : "\E[2;*~" key Ins-AnyModifier : "\E[2~" key Ins+KeyPad : "\E[2~" -key Del+AnyModifier : "\E[3;*~" -key Del-AnyModifier : "\E[3~" -key Del+KeyPad : "\E[3~" -key Return+Shift : "\EOM" -key Return-Shift+NewLine : "\r\n" -key Return-Shift-NewLine : "\r" -key Enter-NewLine : "\r" -key Enter+NewLine : "\r\n" -key Backtab-Ansi : "\t" -key Backtab+Ansi : "\E[Z" -key Backspace+Ctrl+AppScreen : "\E[4b" -key Backspace-AnyModifier : "\x7f" -key Backspace+Ctrl-AppScreen : "\x17" -key Esc : "\E" -key Tab+Shift-Ansi : "\t" -key Tab+Shift+Ansi : "\E[Z" -key Tab-Shift : "\t" -key PgUp+Shift-AppScreen : ScrollPageUp -key PgUp-Shift+AnyModifier : "\E[5;*~" -key PgUp-Shift-AnyModifier : "\E[5~" -key PgUp-Shift+KeyPad : "\E[5~" -key PgDown+Shift-AppScreen : ScrollPageDown +key Left-Shift+Ansi+AnyModifier : "\E[1;*D" +key Left-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[D" +key Left-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOD" +key Left-Shift-Ansi : "\ED" +key Left+Shift+AppScreen : "\E[1;*D" +key Left-Shift+KeyPad+Ansi-AppCursorKeys : "\E[D" +key Left-Shift+KeyPad+Ansi+AppCursorKeys : "\EOD" +key M+Ctrl+AppScreen : "\E[4e" key PgDown-Shift+AnyModifier : "\E[6;*~" key PgDown-Shift-AnyModifier : "\E[6~" +key PgDown+Shift-AppScreen : ScrollPageDown key PgDown-Shift+KeyPad : "\E[6~" -key Right-Shift+KeyPad+Ansi-AppCursorKeys : "\E[C" -key Right-Shift+KeyPad+Ansi+AppCursorKeys : "\EOC" -key Right+Shift+AppScreen : "\E[1;*C" +key PgUp-Shift+AnyModifier : "\E[5;*~" +key PgUp-Shift-AnyModifier : "\E[5~" +key PgUp+Shift-AppScreen : ScrollPageUp +key PgUp-Shift+KeyPad : "\E[5~" +key Return+Shift : "\EOM" +key Return-Shift-NewLine : "\r" +key Return-Shift+NewLine : "\r\n" key Right-Shift+Ansi+AnyModifier : "\E[1;*C" key Right-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[C" key Right-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOC" key Right-Shift-Ansi : "\EC" -key Down+Shift-AppScreen : ScrollLineDown -key Down-Shift+KeyPad+Ansi-AppCursorKeys : "\E[B" -key Down-Shift+KeyPad+Ansi+AppCursorKeys : "\EOB" -key Down+Shift+AppScreen : "\E[1;*B" -key Down-Shift+Ansi+AnyModifier : "\E[1;*B" -key Down-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[B" -key Down-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOB" -key Down-Shift-Ansi : "\EB" -key Left-Shift+KeyPad+Ansi-AppCursorKeys : "\E[D" -key Left-Shift+KeyPad+Ansi+AppCursorKeys : "\EOD" -key Left+Shift+AppScreen : "\E[1;*D" -key Left-Shift+Ansi+AnyModifier : "\E[1;*D" -key Left-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[D" -key Left-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOD" -key Left-Shift-Ansi : "\ED" +key Right+Shift+AppScreen : "\E[1;*C" +key Right-Shift+KeyPad+Ansi-AppCursorKeys : "\E[C" +key Right-Shift+KeyPad+Ansi+AppCursorKeys : "\EOC" key Space+Ctrl : "\x00" -key Up+Shift-AppScreen : ScrollLineUp -key Up-Shift+KeyPad+Ansi-AppCursorKeys : "\E[A" -key Up-Shift+KeyPad+Ansi+AppCursorKeys : "\EOA" -key Up+Shift+AppScreen : "\E[1;*A" +key Tab+Ctrl+Ansi : "\E[27;5;9~" +key Tab+Ctrl-Ansi : "\t" +key Tab+Shift+Ansi : "\E[Z" +key Tab+Shift-Ansi : "\t" +key Tab-Shift : "\t" key Up-Shift+Ansi+AnyModifier : "\E[1;*A" key Up-Shift+Ansi-AppCursorKeys-AnyModifier : "\E[A" key Up-Shift+Ansi+AppCursorKeys-AnyModifier : "\EOA" key Up-Shift-Ansi : "\EA" -key Home+Shift-AppScreen : ScrollUpToTop -key Home+AnyModifier : "\E[1;*H" -key Home+AppCursorKeys-AnyModifier : "\EOH" -key Home-AppCursorKeys-AnyModifier : "\E[H" -key Home+KeyPad-AppCursorKeys : "\E[H" -key Home+KeyPad+AppCursorKeys : "\EOH" -key .+Ctrl+AppScreen : "\E[4c" -key I+Ctrl+AppScreen : "\E[4d" -key M+Ctrl+AppScreen : "\E[4e" -key End+Shift-AppScreen : ScrollDownToBottom -key End+AnyModifier : "\E[1;*F" -key End+AppCursorKeys-AnyModifier : "\EOF" -key End-AppCursorKeys-AnyModifier : "\E[F" -key End+KeyPad-AppCursorKeys : "\E[F" -key End+KeyPad+AppCursorKeys : "\EOF" +key Up+Shift+AppScreen : "\E[1;*A" +key Up+Shift-AppScreen : ScrollLineUp +key Up-Shift+KeyPad+Ansi-AppCursorKeys : "\E[A" +key Up-Shift+KeyPad+Ansi+AppCursorKeys : "\EOA" diff --git a/subdir_files/.local/share/konsole/profanity.profile b/subdir_files/.local/share/konsole/profanity.profile new file mode 100644 index 0000000..c9786ed --- /dev/null +++ b/subdir_files/.local/share/konsole/profanity.profile @@ -0,0 +1,15 @@ +[Appearance] +ColorScheme=Linux +Font=DejaVu Sans Mono,12,-1,5,50,0,0,0,0,0 + +[General] +LocalTabTitleFormat=%w +Name=profanity +Parent=FALLBACK/ +RemoteTabTitleFormat=%w + +[Keyboard] +KeyBindings=ian + +[Scrolling] +HistorySize=100000 diff --git a/subdir_files/.local/share/konsole/profileian.profile b/subdir_files/.local/share/konsole/profileian.profile index 25760ac..6c55a5e 100644 --- a/subdir_files/.local/share/konsole/profileian.profile +++ b/subdir_files/.local/share/konsole/profileian.profile @@ -1,5 +1,5 @@ [Appearance] -ColorScheme=BlackOnRandomLight +ColorScheme=BlackOnLightYellow Font=DejaVu Sans Mono,12,-1,5,50,0,0,0,0,0 [General] diff --git a/switch-mail-host b/switch-mail-host index 21d9882..3a362c3 100644 --- a/switch-mail-host +++ b/switch-mail-host @@ -281,7 +281,9 @@ EOF fi } | $new_shell bash -s -$old_shell bash -s <<'EOF' +if ! $mail_only; then + $old_shell bash -s <<'EOF' +set -e if pgrep -G iank -u iank -f 'emacs --daemon' &>/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 @@ -289,7 +291,16 @@ if pgrep -G iank -u iank -f 'emacs --daemon' &>/dev/null; then exit 1 fi fi + +# 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 ||: + +if [[ -e /p/profanity-here ]]; then + systemctl disable --now profanity +fi EOF +fi # previously, I was checking to see if the new mail host # is on my home network, then changing my home dns @@ -323,6 +334,9 @@ if $host2_only; then m $old_shell systemctl --now disable btrbk.timer fi m $new_shell systemctl --now enable btrbk.timer + if [[ -e /p/profanity-here ]]; then + m $new_shell systemctl --now enable profanity + fi exit 0 fi @@ -332,9 +346,6 @@ if (( ret )); then exit $ret fi -# 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. -m $new_shell killall -q emacs ||: e Running main btrbk m btrbk-run -v --fast $bbk_args $force_arg $incremental_arg -m /o || ret=$? @@ -363,4 +374,12 @@ if (( ret )); then exit $ret fi +if ! $mail_only && [[ -e /p/profanity-here ]]; then + m $new_shell systemctl --now enable profanity || ret=$? + if (( ret )); then + err "failed final systemctl --now enable profanity, just fix and rerun" + exit $ret + fi +fi + m exit 0 diff --git a/system-status b/system-status index b31032c..3ac05d5 100755 --- a/system-status +++ b/system-status @@ -136,33 +136,32 @@ write-status() { # set -x # PS4='+ $(date "+%2N") ' # allow failure in case there are no snapshots yet. - # shellcheck disable=SC2012 shopt -s nullglob files=($btrbk_root/$vol.20*) shopt -u nullglob - if (( ! ${#files[@]} )); then - continue - fi - snaps=($(ls -1avdr "${files[@]}" 2>/dev/null |head -n1 || : )) - now=$EPOCHSECONDS - maxtime=0 - for s in ${snaps[@]}; do - file=${s##*/} - t=$(date -d $(sed -r 's/(.{4})(..)(.{5})(..)(.*)/\1-\2-\3:\4:\5/' <<<${file#$vol.}) +%s) - if (( t > maxtime )); then - maxtime=$t - fi - done - snapshotmsg= - last_snap_age=$(( now - maxtime )) - last_snap_hours=$(( last_snap_age / 60 / 60 )) - if (( last_snap_age > old_snap_limit )); then - chars+=(OLD-SNAP-${last_snap_hours}h) - snapshotmsg="/$vol snapshot older than 4 hours" - if [[ $MAIL_HOST == "$HOSTNAME" ]]; then - p "$snapshotmsg" | lo -1 old-snapshot + if (( ${#files[@]} )); then + # shellcheck disable=SC2012 # using ls version sort. not sure this is needed. + snaps=("$(ls -1avdr "${files[@]}" 2>/dev/null |head -n1 || : )") + now=$EPOCHSECONDS + maxtime=0 + for s in ${snaps[@]}; do + file=${s##*/} + t=$(date -d "$(sed -r 's/(.{4})(..)(.{5})(..)(.*)/\1-\2-\3:\4:\5/' <<<${file#"$vol."})" +%s) + if (( t > maxtime )); then + maxtime=$t + fi + done + snapshotmsg= + last_snap_age=$(( now - maxtime )) + last_snap_hours=$(( last_snap_age / 60 / 60 )) + if (( last_snap_age > old_snap_limit )); then + chars+=(OLD-SNAP-${last_snap_hours}h) + snapshotmsg="/$vol snapshot older than 4 hours" + if [[ $MAIL_HOST == "$HOSTNAME" ]]; then + p "$snapshotmsg" | lo -1 old-snapshot + fi + # not bothering to get info on all volumes if we find an old one. fi - # not bothering to get info on all volumes if we find an old one. fi @@ -272,6 +271,7 @@ write-status() { for mid in $(exiqgrep -o 2400 -zi); do if exim -Mvh $mid | awk 'tolower($2) == "fdate:"' | grep -q .; then qlen=$(( qlen - 1 )) + # shellcheck disable=SC2016 # exim var, not a bash bar if (( $(date -d "$(exim -Mset $mid -be <<<'$h_date:' | sed -n 's/^> *//;/./p')" +%s) < EPOCHSECONDS )); then if ip a show veth0-mail &>/dev/null; then pid=$(pgrep -f "/usr/sbin/exim4 -bd -q30m -C /etc/exim4/my.conf"|head -n1); -- 2.30.2