mostly fixy type changes
authorIan Kelling <ian@iankelling.org>
Tue, 14 Apr 2026 16:38:18 +0000 (12:38 -0400)
committerIan Kelling <ian@iankelling.org>
Tue, 14 Apr 2026 16:38:18 +0000 (12:38 -0400)
14 files changed:
brc
brc2
distro-end
filesystem/etc/systemd/system/profanity.service [new file with mode: 0644]
filesystem/usr/local/bin/prof-tail
filesystem/usr/local/bin/prof-tmux-attach
filesystem/usr/local/bin/switch-mail-host
fsf-script-lib
machine_specific/frodo/filesystem/etc/mdadm/mdadm.conf
machine_specific/frodo/filesystem/etc/systemd/system/profanity.service.d/frodo.conf [moved from machine_specific/frodo/subdir_files/.config/systemd/user/profanity.service.d/frodo.conf with 73% similarity]
machine_specific/frodo/filesystem/etc/systemd/system/transmission-daemon-nn.service.d/frodo.conf [new file with mode: 0644]
mailtest-check
subdir_files/.config/konsolerc
subdir_files/.config/systemd/user/profanity.service [deleted file]

diff --git a/brc b/brc
index 22bb48791a0aaec6cfd63396d9226dda9075369b..34543607df55408523183a6006a6430964314778 100644 (file)
--- a/brc
+++ b/brc
@@ -801,6 +801,17 @@ tsl() {
     printf "%s\n" "note: this log file contains logs before those of previous command" | ts "%F %T" | tee -a "$log_path"
   fi
 }
+# This is an awk script which adds timestamps to those lines that are missing it.
+# It was a very specific/odd situation which drove me to make this. Actually ran
+# it from a file, gawk -F ts.awk (ts.awk had the following string).
+# {
+#     if ($0 !~ /^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/) {
+#         print strftime("%Y-%m-%d %H:%M:%S") "     - " $0
+#     } else {
+#         print $0
+#     }
+# }
+
 
 
 # Gets all the essential disk info on a machine. In case it gets ill, this
@@ -1060,7 +1071,7 @@ cbs() {
 
 # a1 = awk {print $1}
 for _field in {1..20}; do
-  eval a$_field"() { awk '{print \$$_field}'; }"
+  eval a$_field"() { awk '{print \$$_field}' \"\$@\"; }"
 done
 unset _field
 # h1 = head -n1
@@ -1069,6 +1080,10 @@ for _num in {1..9}; do
 done
 unset _num
 
+# awk print final field.
+af() {
+  awk '{print $NF}' "$@"
+}
 
 hexipv4() {
   # shellcheck disable=SC2046 disable=SC2001 disable=SC2183 # hacks, expected
@@ -4921,7 +4936,8 @@ na() {
 
 # wait for PID $1 to die
 pidw() {
-local x=$(mktemp); e $pid >$x; pidwait -e -F $x; rm $x
+  local pid="$1"
+  local x=$(mktemp); e $pid >$x; pidwait -e -F $x; rm $x
 }
 
 # printf string + newline
diff --git a/brc2 b/brc2
index d262054976bab48fdcfc35767485980d8f02d4df..f6f38beb953a50bb93086bb4f50f68b84ddfda22 100644 (file)
--- a/brc2
+++ b/brc2
@@ -65,17 +65,21 @@ path_add --end ~/.local/bin
 #path_add --ifexists --end /a/opt/scancode-toolkit-3.10.
 path_add --ifexists --end /p/bin
 
-### stuff recommended by CPAN. However it is quite annoying that these things blindly
+
+### Commented because I tried a cpan module, but didn't want to keep it, so I removed cpan too,
+### then I found that this was causing problems with my perl.
+###
+### Stuff recommended by CPAN. However it is quite annoying that these things blindly
 # add on to existing vars, so if you source this file multiple times, you get crazy long vars.
-# So, I fix.
-path_add --end /home/iank/perl5/bin
-if [[ ! $PERL5LIB ]]; then
-  PERL5LIB=/home/iank/perl5/lib/perl5
-  PERL_LOCAL_LIB_ROOT=/home/iank/perl5
-  PERL_MB_OPT="--install_base /home/iank/perl5"
-  PERL_MM_OPT=INSTALL_BASE=/home/iank/perl5
-  export PERL5LIB PERL_LOCAL_LIB_ROOT PERL_MB_OPT PERL_MM_OPT
-fi
+# So, I fixed.
+path_add --end /home/iank/perl5/bin
+if [[ ! $PERL5LIB ]]; then
+  PERL5LIB=/home/iank/perl5/lib/perl5
+  PERL_LOCAL_LIB_ROOT=/home/iank/perl5
+  PERL_MB_OPT="--install_base /home/iank/perl5"
+  PERL_MM_OPT=INSTALL_BASE=/home/iank/perl5
+  export PERL5LIB PERL_LOCAL_LIB_ROOT PERL_MB_OPT PERL_MM_OPT
+fi
 
 case $HOSTNAME in
   sy|bo)
@@ -2503,6 +2507,7 @@ mns-setup() {
 # When we are setting up a mount namespace, we use this to avoid
 # redundant calls of mns-setup
 mns-no-setup() {
+  if (( $# < 2 )); then err "need at least 2 arguments"; return 1; fi
   local ns
   ns=$1
   shift
@@ -2512,6 +2517,7 @@ mns-no-setup() {
 }
 
 mns() { # mount namespace
+  if (( $# < 2 )); then err "need at least 2 arguments"; return 1; fi
   local ns
   ns=$1
   shift
@@ -2544,6 +2550,7 @@ mnsr() { # mns run (as normal user)
         ;;
     esac
   done
+  if (( $# < 2 )); then err "need at least 2 arguments"; return 1; fi
   ns=$1
   shift
 
@@ -2563,7 +2570,11 @@ mnsr() { # mns run (as normal user)
   m sudm nsenter --mount=/root/mount_namespaces/$ns sudo -u $user -i "${final_args[@]}"
 }
 
-# Run cmd or shell in named mount namespace + systemd network namespace
+# Run a command in named mount namespace + systemd network namespace
+# Usage: mnsd [OPTIONS] MOUNT_NAMESPACE_NAME SYSTEMD_SERVICE_NAME CMD...
+#
+# See below for options.
+#
 mnsd() {
   local ns unit user tmpf pre_check pid alt_user=false
   local -a final_args
@@ -2588,6 +2599,7 @@ mnsd() {
         ;;
     esac
   done
+  if (( $# < 3 )); then err "need at least 3 arguments"; return 1; fi
   ns=$1
   unit=$2
   shift 2
@@ -5071,4 +5083,4 @@ vm.dirty_writeback_centisecs=1500
 EOF
   s sysctl -p$t
 
-  }
+}
index 9ccc8566168250efdee1dc7208e76257320a8376..a9eece009bcb10ac5afcf0a689f5f158795e219e 100755 (executable)
@@ -1416,11 +1416,13 @@ done
 # just fyi: default rpc port is 9091
 
 tr-config-daemon() {
+  settings_copy=$(mktemp)
+  sudo cat $tconf_dir/settings.json >$settings_copy
   d_host_suffix=$(awk '$2 == "'$d_host'" {print $1}' /p/c/host-info)
   u ~/.config/transmission-daemon-iank.rb <<EOF
 #!/usr/bin/ruby
 require 'json'
-p = '$tconf_dir/settings.json'
+p = '$settings_copy'
 s = {
   'rpc-whitelist' => '',
   'rpc-whitelist-enabled' => false,
@@ -1446,22 +1448,18 @@ EOF
 
   tmpf=$(mktemp)
   # shellcheck disable=SC2024 # false positive
-  chmod +x ~/.config/transmission-daemon-iank.rb
-  if ! sudo ~/.config/transmission-daemon-iank.rb >$tmpf; then
-    echo "iank ruby transmission error" >&2
-    return 1
-  fi
+  ruby ~/.config/transmission-daemon-iank.rb >$tmpf
 
 
   # shellcheck disable=SC2154 # false positive
-  if ! sudo diff -q $tmpf $tconf_dir/settings.json &>/dev/null; then
+  if ! diff -q $tmpf $settings_copy &>/dev/null; then
     restart_ser=false
     ser=transmission-daemon-nn
     if ser is-active $ser &>/dev/null; then
       m ser stop $ser
       restart_ser=true
     fi
-    sudo dd of=$tconf_dir/settings.json <$tmpf 2>/dev/null
+    sudo dd if=$tmpf of=$tconf_dir/settings.json  2>/dev/null
     if $restart_ser; then
       sudo cat $tconf_dir/settings.json #debug
       m ser start $ser
@@ -2074,14 +2072,11 @@ curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo
 ##### postgres #####
 
 ver=18
-if [[ $HOSTNAME == frodo ]]; then
-  ver=17
-fi
 # based on https://www.postgresql.org/download/linux/ubuntu/
 if [[ ! -e /etc/apt/sources.list.d/pgdg.sources ]]; then
   pi postgresql-common
   sudo /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh -y noble
-  pi-nostart postgresql-$ver
+  pi-nostart postgresql-$ver postgresql-doc-$ver
   # when we run it, do:
   #sudo -u postgres createuser -d iank
   sudo usermod -a -G postgres iank
diff --git a/filesystem/etc/systemd/system/profanity.service b/filesystem/etc/systemd/system/profanity.service
new file mode 100644 (file)
index 0000000..a7a207c
--- /dev/null
@@ -0,0 +1,26 @@
+[Unit]
+Description=profanity
+After=local-fs.target
+# on desktop, we need /d to mount, and generally having it start later
+# is find and good and this is the last target.
+After=multi-user.target
+
+[Service]
+# tmux requirement
+Type=forking
+# new-session is a tmux command which allows launching profanity.
+ExecStart=/usr/bin/tmux -L profanity new-session -d profanity
+
+Restart=always
+RestartSec=30
+TimeoutStartSec=300
+
+User=iank
+Group=iank
+
+# note: when running it as a system service instead of a user service, it
+# complains about not being able to connect to gpg on startup. but it
+# seems to work fine.
+
+[Install]
+WantedBy=multi-user.target
index 40260e585d0b452a63985073c5c5a9fe845ff931..f3df29700a02c7c71d374e681074685e3f64d057 100755 (executable)
@@ -58,7 +58,7 @@ if [[ $1 == -e ]]; then
   shift
 fi
 
-if pgrep -fA '^/bin/bash /usr/local/bin/prof-tail'; then
+if pgrep -fA '^/bin/bash /usr/local/bin/prof-tail' >/dev/null; then
   if [[ -t 1 ]]; then
     echo "prof-tail already running. exiting"
   fi
index 0ab3dcc5a08e139f70be42172326bc0e23d9b5a5..9a0894845bfe25cd58963de6134e01cc568b9217 100755 (executable)
@@ -39,7 +39,7 @@ fastcon=0
 while true; do
   start=$EPOCHSECONDS
   if ! ssh-add -l | grep SHA256:YEhwH5u+wkqkSl/dCq8rFebi2qz7Os3RmIWPxMg13eA &>/dev/null; then
-    ssh -n prof
+    ssh -l iank -n prof
   fi
   ssh -l iank -t prof tmux -L profanity a ||:
   if (( EPOCHSECONDS > start + 600 )); then
index a4c5f63556856508f69bd9e61340d557024afadb..809b4f5490d48481eca81b83a18180b07ef2efea 100755 (executable)
@@ -371,10 +371,8 @@ if (( ret )); then
   e finished restoring old host as primary, now exiting $ret due to earlier failed btrbk of /o.
   exit $ret
 fi
-
+_s=$(stty size); c=${_s#* }; while ((c-- >0)); do printf $; done; echo
 # new system is usable at this point
-blocks=██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
-printf "%s\n" "${blocks:0:${COLUMNS:-100}}"
 
 # once I accidentally accepted incoming mail on old host. I used this script to copy over that mail:
 #
index 2c5588b52e8854cb1b8e8fbc45d0cac17a1a0357..d561fc6ed99e593e71d7320a7ffb1a84182fc6ae 100644 (file)
@@ -373,6 +373,7 @@ _debug-setx-func() {
     else
       cmd="$BASH_COMMAND"
     fi
+    [[ $COLUMNS ]] || { _s=$(stty size); COLUMNS=${_s#* }; }
     if [[ $COLUMNS == *[0-9]* ]]; then
       # generally fill up 2 rows
       col=$(( COLUMNS * 2 - 20 ))
index 52d5ab58c49392d63221331a841349548c269ae4..a4847ce4d1bf64bde1f5b5f3c2730c82f96df50a 100644 (file)
@@ -1,4 +1,2 @@
 ARRAY /dev/md/pg1 level=raid0 num-devices=4 metadata=1.2 UUID=3bab0b4d:ad7a3136:c75fde32:f4373de1
-   devices=/dev/dm-16,/dev/dm-22,/dev/dm-5,/dev/dm-7
 ARRAY /dev/md/ndi level=raid0 num-devices=4 metadata=1.2 UUID=693bf056:3875b2bb:7794738b:98914a2c
-   #devices=/dev/mapper/int-vgnvme-WD_BLACK_SN850P_for_PS5_8000GB_24517P800200-ndi,/dev/mapper/int-vgnvme-WD_BLACK_SN850X_8000GB_245244802091-ndi,/dev/mapper/int-vgnvme-WD_BLACK_SN850X_8000GB_245244802317-ndi,/dev/mapper/int-vgnvme-WD_BLACK_SN850X_8000GB_25026Y802189-ndi
diff --git a/machine_specific/frodo/filesystem/etc/systemd/system/transmission-daemon-nn.service.d/frodo.conf b/machine_specific/frodo/filesystem/etc/systemd/system/transmission-daemon-nn.service.d/frodo.conf
new file mode 100644 (file)
index 0000000..d6eee90
--- /dev/null
@@ -0,0 +1,4 @@
+[Unit]
+AssertPathExists=/d/tor/.config/transmission-daemon/settings.json
+After=d.mount
+Requires=d.mount
index eef5e8c29944040388f86316c012f5f94a422ff9..fd51a0f0c3fbeebc4b26e424c5712e5293b1ab47 100755 (executable)
@@ -439,7 +439,8 @@ EOF
 
   dir=/var/lib/prometheus/node-exporter
   path=$dir/mailtest-check.prom.$$
-  if $doprom && [[ -e $dir  ]]; then
+  if $doprom && [[ -d $dir  ]]; then
+    find $dir -type f -mmin +1080 -name 'mailtest-check.prom.*'  -delete
     for l in "${p_unexpected_spamd_results[@]}"; do
       printf "%s\n" "$l" >>$path
     done
@@ -449,7 +450,9 @@ EOF
     for l in "${p_last_usec[@]}"; do
       printf "%s\n" "$l" >>$path
     done
-    mv $path $dir/mailtest-check.prom
+    if [[ -s $path ]]; then
+      mv $path $dir/mailtest-check.prom
+    fi
     # note: node_textfile_mtime_seconds will tell us when this last happened. useful for debugging.
   fi
 }
index 32bf4aa2b760438d4fec6231ff323de47b3a529f..6a1f4e95afe50c754a15959d7540f5fb07445b55 100644 (file)
@@ -23,10 +23,10 @@ ShowMenuBarByDefault=false
 2 screens: Width=1916
 2 screens: XPosition=2
 2 screens: YPosition=2
-3840x2160 screen: Height=2156
-3840x2160 screen: Width=956
-3840x2160 screen: XPosition=1922
-3840x2160 screen: YPosition=2
+3840x2160 screen: Height=1718
+3840x2160 screen: Width=1276
+3840x2160 screen: XPosition=2562
+3840x2160 screen: YPosition=440
 DP-0=DP-0
 DP-1 eDP-1=DP-1
 DP-1-1 eDP-1=DP-1-1
diff --git a/subdir_files/.config/systemd/user/profanity.service b/subdir_files/.config/systemd/user/profanity.service
deleted file mode 100644 (file)
index c90c02d..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-[Unit]
-Description=profanity
-# background: i originally started profanity as a system service after
-# networking-online.target but strangely, it had a hidden lock on /p
-# preventing it from unmounting, and the only thing in /p i can see it
-# using is gpg. I could try to get this to run after the last target,
-# which is default.target, but all I can find documented on how to do
-# this is to do this strange unexplained thing of making a new target,
-# aliasing it to the default target and also make it
-# After=default.target. I figured this probably works and is simpler.
-After=gpg-agent.service
-After=local-fs.target
-# on desktop, we need /d to mount, and based on logs, this is the next target after it mounts.
-# However, this does nothing since a user service is blind to system targets.
-After=multi-user.target
-
-Restart=always
-RestartSec=30
-TimeoutStartSec=300
-
-[Service]
-# tmux requirement
-Type=forking
-# new-session is a tmux command which allows launching profanity.
-ExecStart=/usr/bin/tmux -L profanity new-session -d profanity
-
-
-# if we have to move this to a system service:
-#User=iank
-#Group=iank
-
-[Install]
-WantedBy=default.target