general fixes master
authorIan Kelling <ian@iankelling.org>
Sun, 26 May 2024 01:10:02 +0000 (21:10 -0400)
committerIan Kelling <ian@iankelling.org>
Sun, 26 May 2024 01:10:02 +0000 (21:10 -0400)
30 files changed:
.tmux.conf [new file with mode: 0644]
brc
brc2
btrbk-run
btrfsmaint
distro-begin
distro-end
easiest-to-type-numbers
ffs [new file with mode: 0755]
filesystem/usr/local/bin/abrowser
filesystem/usr/local/bin/ethusb-nm [deleted file]
filesystem/usr/local/bin/ethusb-static [deleted file]
i3-pull
i3-sway/common.conf
i3-sway/i3.conf
input-setup
laptop-xrandr
machine_specific/li/filesystem/etc/openvpn/client-config-hole/bb8 [deleted file]
machine_specific/li/filesystem/etc/openvpn/client-config-hole/frodo [deleted file]
machine_specific/li/filesystem/etc/openvpn/client-config-hole/x2
machine_specific/x2/filesystem/etc/systemd/system/openvpn-client-tr@.service
obs-i3-monitor
pkgs
prof
prof-remote
rootsshsync
script-files
subdir_files/.config/systemd/user/profanity.service
subdir_files/.gnupg/gpg.conf
system-status

diff --git a/.tmux.conf b/.tmux.conf
new file mode 100644 (file)
index 0000000..9557d72
--- /dev/null
@@ -0,0 +1,6 @@
+# a 256color term is needed for profanity to have colors, this is
+# recommended by
+# https://unix.stackexchange.com/questions/1045/getting-256-colors-to-work-in-tmux
+set -g default-terminal "tmux-256color"
+# default is green. I prefer it to stand out less.
+set-option -g status-style bg=black
diff --git a/brc b/brc
index 7731b9cdd7c0652302300b7571bb663c4b134726..32a2c66212893c101c8e7c57670f5486a6f613c8 100644 (file)
--- a/brc
+++ b/brc
@@ -774,6 +774,50 @@ EOF
   done
 }
 
   done
 }
 
+screenrtp() {
+
+  local ip port xoffset
+  read -r ip port xoffset <<<"$@"
+
+  setxenv
+
+  if [[ ! $port ]]; then
+    port=9999
+  fi
+
+  while true; do
+    # By default, plugged in screen goes to the right side, so we need an
+    # offset that is the same as the laptop's x resolution. If we are in
+    # mirror mode, then we don't need an offset.
+    if [[ ! $xoffset ]]; then
+      xoffset=0
+      laptop_x=$(xrandr | awk '$1 == "LVDS-1" {print $4}' | sed 's/x.*//') || { sleep 1; continue; }
+      total_x=$(xdpyinfo| awk '$1 == "dimensions:" {print $2}' | sed 's/x.*//') || { sleep 1; continue; }
+      screen2_res=$(xrandr | awk '$2 == "connected" && $1 != "LVDS-1" { print $3 }' | sed 's/+.*//')
+      if (( laptop_x < total_x )); then
+        xoffset=$laptop_x
+      fi
+    fi
+
+    m ffmpeg -probesize 50M -thread_queue_size 50 \
+      -video_size $screen2_res -f x11grab -framerate 30 -i :0.0+$xoffset.0 \
+      -vcodec libx264 -g 1 -tune zerolatency -preset ultrafast -pix_fmt yuv420p -x264-params repeat-headers=1 \
+      -f rtp_mpegts rtp://$ip:$port ||:
+
+
+    sleep 1
+  done
+}
+
+setxenv() {
+  if [[ ! $DISPLAY ]]; then
+    export DISPLAY=:0.0
+  fi
+  if [[ ! $XAUTHORITY ]]; then
+    export XAUTHORITY=$HOME/.Xauthority
+  fi
+}
+
 #### end fsf section
 
 
 #### end fsf section
 
 
@@ -815,25 +859,40 @@ fpst() { # file paste
 }
 
 _khfix-common() {
 }
 
 _khfix-common() {
-  local host ip port file key tmp
-  read -r host ip port < <(timeout -s 9 2 ssh -oBatchMode=yes -oControlMaster=no -oControlPath=/ -v $1 |& sed -rn "s/debug1: Connecting to ([^ ]+) \[([^\]*)] port ([0-9]+).*/\1 \2 \3/p" ||: )
+  local host ip port file key tmp ssh_host alias
+  ssh_host=$1
+  {
+    read -r host ip port
+    read -r alias;
+    # note ":graph:" is needed or else we get a trailing \r out of ssh,
+    # dunno why.  web search says terminals add \r, so I tried adding -T
+    # to turn off psuedo terminal, but it didnt help.
+  } < <(timeout -s 9 2 ssh -TN -oBatchMode=yes -oControlMaster=no -oControlPath=/ -v $ssh_host |&
+        sed -rn "s/debug1: Connecting to ([^ ]+) \[([^\]*)] port ([0-9]+).*/\1 \2 \3/p;
+s/^debug1: using hostkeyalias: ([[:graph:]]*).*/\1/p" ||: )
   file=$(readlink -f ~/.ssh/known_hosts)
   if [[ ! $ip ]]; then
     echo "khfix: ssh failed"
     return 1
   fi
   file=$(readlink -f ~/.ssh/known_hosts)
   if [[ ! $ip ]]; then
     echo "khfix: ssh failed"
     return 1
   fi
+  ip_entry=$ip
+  host_entry=$host
+  if [[ $alias ]]; then
+    host_entry="$alias"
+  fi
   if [[ $port != 22 ]]; then
     ip_entry="[$ip]:$port"
   if [[ $port != 22 ]]; then
     ip_entry="[$ip]:$port"
-    host_entry="[$host]:$port"
-  else
-    ip_entry=$ip
-    host_entry=$host
+    if [[ ! $alias ]]; then
+      host_entry="[$host]:$port"
+    fi
   fi
   fi
-  if [[ $host != "$ip" ]]; then
+  if [[ $host_entry != "$ip_entry" ]]; then
     tmp=$(mktemp)
     ssh-keygen -F "$host_entry" -f $file >$tmp || [[ $? == 1 ]] # 1 when it doesnt exist in the file
     if [[ -s $tmp ]]; then
       key=$(sed -r 's/^.*([^ ]+ +[^ ]+) *$/\1/' $tmp)
     tmp=$(mktemp)
     ssh-keygen -F "$host_entry" -f $file >$tmp || [[ $? == 1 ]] # 1 when it doesnt exist in the file
     if [[ -s $tmp ]]; then
       key=$(sed -r 's/^.*([^ ]+ +[^ ]+) *$/\1/' $tmp)
+    else
+      echo "khfix WARNING: did not find host entry:$host_entry in known_hosts"
     fi
     rm $tmp
     if [[ $key ]]; then
     fi
     rm $tmp
     if [[ $key ]]; then
@@ -845,12 +904,13 @@ _khfix-common() {
   ssh-keygen -F "$ip_entry" -f $file >$tmp || [[ $? == 1 ]]
   if [[ -s $tmp ]]; then
     key=$(sed -r 's/^.*([^ ]+ +[^ ]+) *$/\1/' $tmp)
   ssh-keygen -F "$ip_entry" -f $file >$tmp || [[ $? == 1 ]]
   if [[ -s $tmp ]]; then
     key=$(sed -r 's/^.*([^ ]+ +[^ ]+) *$/\1/' $tmp)
+  else
+    echo "khfix WARNING: did not find ip entry:$ip_entry in known_hosts"
   fi
   rm $tmp
   if [[ $key ]]; then
     grep -Fv "$key" "$file" | sponge "$file"
   fi
   fi
   rm $tmp
   if [[ $key ]]; then
     grep -Fv "$key" "$file" | sponge "$file"
   fi
-  ll ~/.ssh/known_hosts
 }
 khfix-r() { # known hosts fix without syncing to root user
   _khfix-common "$@" || return 1
 }
 khfix-r() { # known hosts fix without syncing to root user
   _khfix-common "$@" || return 1
@@ -1375,7 +1435,12 @@ egrinid() {
   sed -rn '/testignore|jtuttle|eximbackup/!s/^[^ ]+ ([^ ]+) [^ ]+ [^ ]+ <= ([^ ]+).* id=([^ ]+) T="(.*)" from (<[^ ]+> .*$)/\1 \5\n \3\n \4/p' <${1:-/var/log/exim4/mainlog}
 }
 etailin() {
   sed -rn '/testignore|jtuttle|eximbackup/!s/^[^ ]+ ([^ ]+) [^ ]+ [^ ]+ <= ([^ ]+).* id=([^ ]+) T="(.*)" from (<[^ ]+> .*$)/\1 \5\n \3\n \4/p' <${1:-/var/log/exim4/mainlog}
 }
 etailin() {
-  tail -F /var/log/exim4/mainlog | sed -rn '/testignore|jtuttle|eximbackup/!s/^[^ ]+ ([^ ]+) [^ ]+ [^ ]+ <= ([^ ]+).*T="(.*)" from (<[^ ]+> .*$)/\1 \4\n \3/p'
+  local -a tail_arg
+  tail_arg=(-n500)
+  if [[ $1 ]]; then
+    tail_arg=($@)
+  fi
+  tail "${tail_arg[@]}" -F /var/log/exim4/mainlog | sed -rn '/testignore|jtuttle|eximbackup/!s/^[^ ]+ ([^ ]+) [^ ]+ [^ ]+ <= ([^ ]+).*T="(.*)" from (<[^ ]+> .*$)/\1 \4\n \3/p'
 }
 
 
 }
 
 
@@ -2046,9 +2111,9 @@ nags() {
   /usr/bin/nagstamon &
 }
 
   /usr/bin/nagstamon &
 }
 
-# profanity screen
+# profanity tmux
 profsrc() {
 profsrc() {
-  screen -RD -S profanity
+  screen -L profanity a
 }
 
 # i dont want to wait for konsole to exit...
 }
 
 # i dont want to wait for konsole to exit...
@@ -2731,8 +2796,15 @@ sl() {
 slr() {
   sl --rsync "$@"
 }
 slr() {
   sl --rsync "$@"
 }
-sss() { # ssh solo
-  sl -oControlMaster=no -oControlPath=/ "$@"
+
+
+# ssh solo
+#
+# WARNING: If you are trying to use -i, remember that keys added to
+# agent previously will still be tried. Use ssh-add -D to remove all
+# keys from the agent.
+sss() {
+  ssh -oControlMaster=no -oControlPath=/ "$@"
 }
 # kill off old shared socket then ssh
 ssk() {
 }
 # kill off old shared socket then ssh
 ssk() {
@@ -3375,6 +3447,39 @@ if [[ $- == *i* ]]; then
 
 fi
 
 
 fi
 
+
+lp22viewers() {
+  v=0
+  roomv=(0 0)
+  rooms=(jupiter saturn)
+  for ip in 209.51.188.25 live.fsf.org; do
+    out=$(curl -sS --insecure https://$ip/)
+    for i in 0 1 2; do
+      room=${rooms[i]}
+      while read -r n; do
+        v=$((v+n))
+        roomv[$i]=$(( ${roomv[$i]} + n ))
+      done < <(printf "%s\n" "$out"  | grep -Po "$room.*?current[^0-9]*[0-9]*" | grep -o '[0-9]*$' )
+    done
+  done
+  printf "total: %s " $v
+  for i in 0 1; do
+    room=${rooms[i]}
+    printf "$room: %s " "${roomv[$i]}"
+  done
+  echo
+}
+
+arpflush() {
+  local default_route_dev
+  default_route_dev=$(ip r show default | sed 's/.*dev \([^ ]*\).*/\1/' | head -n1)
+  m s ip n flush dev "$default_route_dev"
+}
+
+dsh() {
+  command dsh -c "$@"
+}
+
 # * stuff that makes sense to be at the end
 
 
 # * stuff that makes sense to be at the end
 
 
diff --git a/brc2 b/brc2
index 05de0a3f1cf93cbc19db5213794c83b6a129807f..6ac51839640d6b111de332c2196a89468ff154f4 100644 (file)
--- a/brc2
+++ b/brc2
@@ -441,7 +441,7 @@ ralerts() { # remote alerts
 ap() {
   # pushd in case current directory has an ansible.cfg file
   pushd /a/xans >/dev/null
 ap() {
   # pushd in case current directory has an ansible.cfg file
   pushd /a/xans >/dev/null
-  ansible-playbook -v -l ${1:- $(hostname -f)} site.yml
+  ansible-playbook -v -i ${1:- $(hostname -f)}, site.yml
   popd >/dev/null
 }
 aw() {
   popd >/dev/null
 }
 aw() {
@@ -1504,7 +1504,6 @@ btrbk-host-debug() {
 
 # $ dig ns1.gnu.org @b0.org.afilias-nst.org.
 
 
 # $ dig ns1.gnu.org @b0.org.afilias-nst.org.
 
-# todo: make sm pull/push use systemd instead of the journal cat command
 bbk() { # btrbk wrapper
   local ret=0
   c /
 bbk() { # btrbk wrapper
   local ret=0
   c /
@@ -1855,7 +1854,13 @@ dsign() {
 # set day start for use in other programs.
 # expected to do be in a format like 830, or 800 or 1300.
 ds() {
 # set day start for use in other programs.
 # expected to do be in a format like 830, or 800 or 1300.
 ds() {
+  local regex
+  regex='[0-9]?[0-9]?[0-9][0-9]'
   if [[ $1 ]]; then
   if [[ $1 ]]; then
+    if [[ ! $1 =~ $regex ]]; then
+      echo "ds: error. expected \$1 to match $regex, got \$1: $1"
+      return 1
+    fi
     echo $1 >/b/data/daystart
   else
     cat /b/data/daystart
     echo $1 >/b/data/daystart
   else
     cat /b/data/daystart
@@ -1998,8 +2003,8 @@ apache-header() {
 # https://www.gnu.org/licenses/license-recommendations.en.html. They
 # recommend that small programs, < 300 lines, be licensed under the
 # Apache License 2.0. This file contains or is part of one or more small
 # https://www.gnu.org/licenses/license-recommendations.en.html. They
 # recommend that small programs, < 300 lines, be licensed under the
 # Apache License 2.0. This file contains or is part of one or more small
-# programs. If a small program grows beyond 300 lines, I plan to switch
-# its license to GPL.
+# programs. If a small program grows beyond 300 lines, I plan to change
+# to a recommended GPL license.
 
 # Copyright 2024 Ian Kelling
 
 
 # Copyright 2024 Ian Kelling
 
@@ -2638,19 +2643,29 @@ wgkey() {
 
 host-info-all() {
   host-info-update
 
 host-info-all() {
   host-info-update
+
   bindpushb8
   bindpushb8
+  # for wireguard configs
   ssh iank@li.b8.nz conflink
   wrt-setup
 }
 
 
   ssh iank@li.b8.nz conflink
   wrt-setup
 }
 
 
-# if you change a host's ip, then run
-# bindpushb8
-# wrt-setup
+
+
+
+## for updating host info like ip, location, update /p/c/host-info and
+## host_info below. the host_info array should probably be in its own
+## file that gets sourced so that it can be more easily updated.
+
+# todo: this is so long that it becomes confusing,
+# try to split it up.
+#
+# To make some changes take effect, run host-info-all.
 host-info-update() {
 
 host-info-update() {
 
-  local -A vpn_ips host_ips host_macs nonvpn_ips all_ips
-  local -a root_hosts nonroot_hosts host_usbs
+  local -A vpn_ips host_ips host_macs portfw_ips nonvpn_ips all_ips
+  local -a root_hosts nonroot_hosts
 
   # the hosts with no mac
   root_hosts=( bk je li b8.nz )
 
   # the hosts with no mac
   root_hosts=( bk je li b8.nz )
@@ -2678,6 +2693,7 @@ host-info-update() {
 
     all_ips[$host]=$ip
     if $vpn; then
 
     all_ips[$host]=$ip
     if $vpn; then
+      portfw_ips[$host]=$ip
       vpn_ips[$host]=$ip
     else
       nonvpn_ips[$host]=$ip
       vpn_ips[$host]=$ip
     else
       nonvpn_ips[$host]=$ip
@@ -2687,6 +2703,7 @@ host-info-update() {
       # hosts is that it is for the User part, the IdentityFile part is
       # redundant to *.b8.nz. Also note ${host}i, we only setup those for vpn hosts, but there is no harm in overspecifying here.
       root_hosts+=($host ${host}i $host.b8.nz ${host}i.b8.nz)
       # hosts is that it is for the User part, the IdentityFile part is
       # redundant to *.b8.nz. Also note ${host}i, we only setup those for vpn hosts, but there is no harm in overspecifying here.
       root_hosts+=($host ${host}i $host.b8.nz ${host}i.b8.nz)
+      root_hosts_a[$host]=t  # a for associative array
     else
       nonroot_hosts+=($host ${host}i)
     fi
     else
       nonroot_hosts+=($host ${host}i)
     fi
@@ -2710,10 +2727,8 @@ EOF
     for host in ${!vpn_ips[@]}; do
       ipsuf=${vpn_ips[$host]}
       cat <<EOF
     for host in ${!vpn_ips[@]}; do
       ipsuf=${vpn_ips[$host]}
       cat <<EOF
-Host ${host}i
-Hostname b8.nz
+Host ${host}i ${host}i.b8.nz
 Port $((2200 + ipsuf))
 Port $((2200 + ipsuf))
-
 EOF
     done
 
 EOF
     done
 
@@ -2724,7 +2739,7 @@ Host $host ${host}i $host.b8.nz ${host}i.b8.nz
 HostKeyAlias $host.b8.nz
 EOF
     done
 HostKeyAlias $host.b8.nz
 EOF
     done
-  } | cedit /p/c/subdir_files/.ssh/config || [[ $? == 1 ]]
+  } | cedit -e /p/c/subdir_files/.ssh/config-static
 
   {
     # hack to please emacs parser
 
   {
     # hack to please emacs parser
@@ -2756,7 +2771,7 @@ EOF
   # shellcheck disable=SC2016 # shellcheck doesnt know this is sed
   sedi '/edits below here are made automatically/,$d' /p/c/machine_specific/li/filesystem/etc/wireguard/wgmail.conf
   for host in ${!vpn_ips[@]}; do
   # shellcheck disable=SC2016 # shellcheck doesnt know this is sed
   sedi '/edits below here are made automatically/,$d' /p/c/machine_specific/li/filesystem/etc/wireguard/wgmail.conf
   for host in ${!vpn_ips[@]}; do
-    if [[ ${root_ips[$host]} ]]; then
+    if [[ ${root_hosts_a[$host]} ]]; then
       # root machines dont actually need vpn, but
       # the classification still helps with other
       # configurations.
       # root machines dont actually need vpn, but
       # the classification still helps with other
       # configurations.
@@ -2764,7 +2779,7 @@ EOF
     fi
     ipsuf=${vpn_ips[$host]}
     wghole $host $ipsuf
     fi
     ipsuf=${vpn_ips[$host]}
     wghole $host $ipsuf
-    sd /b/ds/machine_specific/li/filesystem/etc/openvpn/client-config-hole/$host <<EOF
+    u /b/ds/machine_specific/li/filesystem/etc/openvpn/client-config-hole/$host <<EOF
 ifconfig-push 10.5.5.${vpn_ips[$host]} 255.255.255.0
 EOF
     u /a/bin/ds/machine_specific/$host/filesystem/etc/systemd/system/openvpn-client-tr@.service <<EOF
 ifconfig-push 10.5.5.${vpn_ips[$host]} 255.255.255.0
 EOF
     u /a/bin/ds/machine_specific/$host/filesystem/etc/systemd/system/openvpn-client-tr@.service <<EOF
@@ -2819,7 +2834,7 @@ EOF
 
   {
     echo "cat <<EOF"
 
   {
     echo "cat <<EOF"
-    for host in ${!host_ips[@]}; do
+    for host in ${!host_macs[@]}; do
       ipsuf=${host_ips[$host]}
       echo "dhcp-host=${host_macs[$host]},set:$host,\$l.$ipsuf,$host"
     done
       ipsuf=${host_ips[$host]}
       echo "dhcp-host=${host_macs[$host]},set:$host,\$l.$ipsuf,$host"
     done
@@ -2845,9 +2860,10 @@ $host    A       10.2.0.$ipsuf
 ${host}wg      A       10.8.0.$ipsuf
 ${host}vp      A       10.5.5.$ipsuf
 ${host}tr      A       10.174.$ipsuf.2
 ${host}wg      A       10.8.0.$ipsuf
 ${host}vp      A       10.5.5.$ipsuf
 ${host}tr      A       10.174.$ipsuf.2
+${host}i       A       $b8_ip
 EOF
     done
 EOF
     done
-  } | cedit vpn-ips-update /p/c/machine_specific/vps/bind-initial/db.b8.nz ||:
+  } | cedit -e vpn-ips-update /p/c/machine_specific/vps/bind-initial/db.b8.nz
 
 
   echo checking for stray files:
 
 
   echo checking for stray files:
@@ -2870,15 +2886,105 @@ EOF
 /p/c/machine_specific filesystem/etc/wireguard/wghole.conf
 EOF
 
 /p/c/machine_specific filesystem/etc/wireguard/wghole.conf
 EOF
 
-  files=(/b/ds/machine_specific/li/filesystem/etc/openvpn/client-config-hole/* )
+  files=( /b/ds/machine_specific/li/filesystem/etc/openvpn/client-config-hole/* )
   for f in "${files[@]}"; do
   for f in "${files[@]}"; do
-    host=${f##/*}
+    host=${f##*/}
     if [[ ! ${vpn_ips[$host]} ]]; then
       e rm $f
       e ssh root@li.b8.nz rm -f $f
     fi
   done
 
     if [[ ! ${vpn_ips[$host]} ]]; then
       e rm $f
       e ssh root@li.b8.nz rm -f $f
     fi
   done
 
+  tmpf=$(mktemp)
+  {
+    printf "%s" "Host * "
+    sed -n '/^Host /h;/^IdentityFile .*\/home/{g;s/^Host//;s/ / !/gp}' /p/c/subdir_files/.ssh/config-static | tr '\n' ' '
+    echo
+    echo "IdentityFile ~/.ssh/work"
+  } >$tmpf
+  cedit -e work-identity /p/c/subdir_files/.ssh/config-static <$tmpf
+  rm -f $tmpf
+
+  ### begin focus on hosts file update ###
+  #
+  # This started as its own function, but it actually
+  # needed to alter the ssh config, so combined it.
+  #
+  # background: This is finally doing dynamic ip resolution via the hosts
+  # file. I considered detecting where each host was dynamically or
+  # something, but ultimately decided to mostly avoid that, other than
+  # detecting the status of the current machine I'm on.  I want to be able
+  # to move it around without having to manually type much of anything.
+  local -a host_domain_suffix hosts
+  local -A ip_to_hosts
+  local suf ip i host at_home suf_from_here
+
+  source /p/c/domain-info
+
+  at_home=false
+  if ip n | grep -q "10.2.0.1 .* b4:75:0e:fd:06:4a"; then
+    at_home=true
+  fi
+
+  for i in ${host_domain_suffix[@]}; do
+    if [[ $i == *.* ]]; then
+      suf=$i
+      continue
+    fi
+    hosts+=($i)
+    if [[ $i == "$HOSTNAME" ]]; then
+      unset "portfw_ips[$i]"
+      continue
+    fi
+
+    suf_from_here=$suf
+    if ! $at_home && [[ $suf == .b8.nz || $suf == [wc].b8.nz ]]; then
+      suf_from_here=i.b8.nz
+    else
+      unset "portfw_ips[$i]"
+    fi
+
+    ip=$(getent ahostsv4 "$i$suf_from_here" | awk '{ print $1 }' | head -n1) ||:
+    if [[ ! $ip ]]; then
+      if [[ $suf == .office.fsf.org ]]; then
+        suf_from_here=wg.b8.nz
+        ip=$(getent ahostsv4 "$i$suf_from_here" | awk '{ print $1 }' | head -n1) ||:
+      fi
+      if [[ ! $ip ]]; then
+        echo error: failed to get ip of "$i$suf_from_here"
+        return 1
+      fi
+    fi
+    ip_to_hosts[$ip]+=" $i"
+  done
+
+  for ip in "${!ip_to_hosts[@]}"; do
+    echo "$ip${ip_to_hosts[$ip]}"
+  done | s cedit -e hosts-file-up /etc/hosts
+  for host in ${hosts[@]}; do
+    echo $host
+  done >/p/c/subdir_files/.dsh/group/btrbk
+  ### end focus on hosts file update ###
+
+
+  # note: note sure if this is a great way to check.
+  # todo: think about it
+
+  if $at_home; then
+    # possible that in the future we want to create
+    # a dynamic file here, and then we can move the cat
+    # command above out of the conditional
+    rsync -a /p/c/subdir_files/.ssh/config-static ~/.ssh/config
+  else
+    for host in ${!portfw_ips[@]}; do
+      ipsuf=${portfw_ips[$host]}
+      cat <<EOF
+Host ${host}
+Port $((2200 + ipsuf))
+EOF
+    done > ~/.ssh/config-dynamic
+    cat /p/c/subdir_files/.ssh/config-static ~/.ssh/config-dynamic  >~/.ssh/config
+  fi
 }
 
 # usage host ipsuf [extrahost]
 }
 
 # usage host ipsuf [extrahost]
@@ -3278,8 +3384,8 @@ myprof() {
   pushd /home/iank/.local/share/profanity/chatlogs/iank_at_fsf.org/rooms/office_at_conference.fsf.org
   logs=(*)
   logcount=${#logs[@]}
   pushd /home/iank/.local/share/profanity/chatlogs/iank_at_fsf.org/rooms/office_at_conference.fsf.org
   logs=(*)
   logcount=${#logs[@]}
-  if (( logcount > 15 )); then
-    i=$(( logcount - 15 ))
+  if (( logcount > 16 )); then
+    i=$(( logcount - 16 ))
   else
     i=0
   fi
   else
     i=0
   fi
@@ -4666,6 +4772,23 @@ tclear() {
   done
 }
 
   done
 }
 
+opensslcertinfo() {
+  openssl x509 -txt -in "$@"
+}
+
+# dsh on btrbk hosts
+dsb() {
+:
+  }
+
+# dsh a file and run it
+dsa() {
+  local ret file
+  if ! parallel -j 10 scp x {}:/tmp <~/.dsh/group/btrbk; then
+    echo parallel scp failed. dsa returning $ret
+    fi
+  dsh -g btrbk
+  }
 
 export BASEFILE_DIR=/a/bin/fai-basefiles
 
 
 export BASEFILE_DIR=/a/bin/fai-basefiles
 
index 8fc4c4f00b8c9f5ea3b64126767c83003e675643..9bd6e9b6f62b3628d68648350c657c021d56d9b6 100644 (file)
--- a/btrbk-run
+++ b/btrbk-run
@@ -45,25 +45,53 @@ EOF
 }
 
 
 }
 
 
+
 pre=btrbk-run
 
 pre=btrbk-run
 
+
+
 script_name="${BASH_SOURCE[0]}"
 script_name="${script_name##*/}"
 script_name="${BASH_SOURCE[0]}"
 script_name="${script_name##*/}"
+
+
+log-setup() {
+  if [[ ! $log_path ]]; then
+    mkdir -p /var/log/btrbk
+    log_path=/var/log/btrbk/$(date +%F_%T%:::z).log
+  fi
+}
 d() {
   if $dry_run || $conf_only; then
     printf "$pre dry-run: %s\n"  "$*"
   else
 d() {
   if $dry_run || $conf_only; then
     printf "$pre dry-run: %s\n"  "$*"
   else
-    printf "$pre running: %s\n"  "$*"
-    "$@"
+    log-setup
+    printf "$pre running: %s\n"  "$*" |& pee cat 'ts "%F %T" >>'$log_path
+    "$@" |& pee cat 'ts "%F %T" >>'$log_path
   fi
 }
 m() { if $verbose; then printf "$pre %s\n"  "$*"; fi;  "$@"; }
 e() { printf "$pre %s\n"  "$*"; }
   fi
 }
 m() { if $verbose; then printf "$pre %s\n"  "$*"; fi;  "$@"; }
 e() { printf "$pre %s\n"  "$*"; }
+
+logq() {
+  local exit_code
+  exit_code=0
+  log-setup
+  printf "$pre running: %s\n"  "$*" | pee cat 'ts "%F %T" >>'$log_path
+  e logging to $log_path
+  "$@" |& ts "%F %T" >>$log_path || exit_code=$?
+  printf "$pre exit code:%s of %s\n" "$exit_code"  "$*" | pee cat 'ts "%F %T" >>'$log_path
+  if (( exit_code > 0 )); then
+    e "error: command exit code: $exit_code. exiting after tail -n50 $log_path"
+    tail -n50 $log_path
+    exit $exit_code
+  fi
+}
+
 die() { printf "$pre error: %s\n" "$*" >&2; echo "$pre exiting with status 1" >&2; exit 1; }
 mexit() { echo "$pre exiting with status $1"; exit $1; }
 
 uninstalled-file-die() {
 die() { printf "$pre error: %s\n" "$*" >&2; echo "$pre exiting with status 1" >&2; exit 1; }
 mexit() { echo "$pre exiting with status $1"; exit $1; }
 
 uninstalled-file-die() {
-  die "uninstalled file $1. run install-my-scripts or rerun with -f"
+  die "file $1 is not latest. run install-my-scripts or rerun with -f"
 }
 
 set-location() {
 }
 
 set-location() {
@@ -104,10 +132,10 @@ add-x3-target() {
   # main work machine
   if ping -q -c1 -w1 x3.office.fsf.org &>/dev/null; then
     targets+=(x3.office.fsf.org)
   # main work machine
   if ping -q -c1 -w1 x3.office.fsf.org &>/dev/null; then
     targets+=(x3.office.fsf.org)
-  elif ping -q -c1 -w1 $h.b8.nz &>/dev/null; then
+  elif ping -q -c1 -w1 x3.b8.nz &>/dev/null; then
     # in case we took it home
     targets+=(x3.b8.nz)
     # in case we took it home
     targets+=(x3.b8.nz)
-  elif ping -q -c1 -w1 ${h}w.b8.nz &>/dev/null; then
+  elif ping -q -c1 -w1 x3w.b8.nz &>/dev/null; then
     targets+=(x3w.b8.nz)
   else
     targets+=(x3wg.b8.nz)
     targets+=(x3w.b8.nz)
   else
     targets+=(x3wg.b8.nz)
@@ -164,7 +192,7 @@ ret=0
 conf_only=false
 dry_run=false # mostly for testing
 rate_limit=no
 conf_only=false
 dry_run=false # mostly for testing
 rate_limit=no
-verbose=true; verbose_arg=-v
+verbose=true; verbose_arg="-l trace"
 force=false
 if [[ $INVOCATION_ID ]]; then
   # INVOCATION_ID means running as a systemd service. we cant show progress in this case,
 force=false
 if [[ $INVOCATION_ID ]]; then
   # INVOCATION_ID means running as a systemd service. we cant show progress in this case,
@@ -203,13 +231,17 @@ fast=false
 kd_spread=false
 check_installed=false
 orig_args=("$@")
 kd_spread=false
 check_installed=false
 orig_args=("$@")
-temp=$(getopt -l check-installed,fast,pull-reexec,help 23cefikl:m:npqrs:t:vh "$@") || usage 1
+temp=$(getopt -l check-installed,fast,pull-reexec,help 23acefikl:m:npqrs:t:vh "$@") || usage 1
 eval set -- "$temp"
 while true; do
   case $1 in
     # for the rare case we want to run multiple instances at the same time
     -2) conf_suf=2 ;;
     -3) conf_suf=3 ;;
 eval set -- "$temp"
 while true; do
   case $1 in
     # for the rare case we want to run multiple instances at the same time
     -2) conf_suf=2 ;;
     -3) conf_suf=3 ;;
+    -a)
+      # all moiuntpoints
+      mountpoints=(/a /o /qr /qd /q)
+      ;;
     # only creates the config file, does not run btrbk
     -c) conf_only=true ;;
     --check-installed)
     # only creates the config file, does not run btrbk
     -c) conf_only=true ;;
     --check-installed)
@@ -254,7 +286,9 @@ while true; do
     # snapshot. we have default hosts we will populate.
     -t) IFS=, targets=($2); unset IFS; shift ;;
     # verbose.
     # snapshot. we have default hosts we will populate.
     -t) IFS=, targets=($2); unset IFS; shift ;;
     # verbose.
-    -v) verbose=true; verbose_arg=-v ;;
+    -v)
+      verbose=true; verbose_arg="-l trace"
+      ;;
     -h|--help) usage ;;
     --) shift; break ;;
     *) die "Internal error!" ;;
     -h|--help) usage ;;
     --) shift; break ;;
     *) die "Internal error!" ;;
@@ -278,7 +312,7 @@ if ! $force && { $check_installed || [[ ! $source ]]; } ; then
     fi
   done
   if ! diff -q /a/bin/bash-bear-trap/bash-bear /usr/local/lib/bash-bear; then
     fi
   done
   if ! diff -q /a/bin/bash-bear-trap/bash-bear /usr/local/lib/bash-bear; then
-    uninstalled-file-die err
+    uninstalled-file-die bash-bear
   fi
   if $check_installed; then
     exit 0
   fi
   if $check_installed; then
     exit 0
@@ -474,21 +508,24 @@ if ! command -v btrbk &>/dev/null; then
   die "error: no btrbk binary found"
 fi
 
   die "error: no btrbk binary found"
 fi
 
+# pull_reexec stops us from getting into an infinite loop if there is some
+# kind of weird problem
+pulla=false
+for m in "${mountpoints[@]}"; do
+  if [[ $m == /a ]]; then
+    pulla=true
+    break
+  fi
+done
+
 if ! $pull_reexec && [[ $source ]] && $pulla && ! $force ; then
 if ! $pull_reexec && [[ $source ]] && $pulla && ! $force ; then
-  ssh root@$source btrbk-run --check-installed || exit 1
+  ssh root@$source btrbk-run --check-installed
 fi
 
 #### end pre-checks #####
 
 
 
 fi
 
 #### end pre-checks #####
 
 
 
-mkdir -p /var/log/btrbk
-# The journal doesnt go back to my oldest backups, and I've found myself
-# wanting older logs. Not going to bother expiring old logs, since it is
-# fine if they go back years.
-log_path=/var/log/btrbk/$(date +%F_%T%:::z).log
-echo copying output to $log_path
-exec &> >(pee cat 'ts "%F %T"|dd of='$log_path' status=none')
 
 # print some non-default opts
 if $verbose; then
 
 # print some non-default opts
 if $verbose; then
@@ -519,26 +556,6 @@ if $verbose; then
   fi
 fi
 
   fi
 fi
 
-if [[ -v targets ]]; then
-  echo "targets: ${targets[*]}"
-fi
-
-if [[ $source ]]; then
-  echo "source: $source"
-fi
-
-echo "mountpoints: ${mountpoints[*]}"
-
-
-# pull_reexec stops us from getting into an infinite loop if there is some
-# kind of weird problem
-pulla=false
-for m in "${mountpoints[@]}"; do
-  if [[ $m == /a ]]; then
-    pulla=true
-    break
-  fi
-done
 
 if ! $pull_reexec && [[ $source ]] && $pulla ; then
   tmpf=$(mktemp)
 
 if ! $pull_reexec && [[ $source ]] && $pulla ; then
   tmpf=$(mktemp)
@@ -553,6 +570,16 @@ if ! $pull_reexec && [[ $source ]] && $pulla ; then
   fi
 fi
 
   fi
 fi
 
+
+if [[ -v targets ]]; then
+  echo "targets: ${targets[*]}"
+fi
+if [[ $source ]]; then
+  echo "source: $source"
+fi
+echo "mountpoints: ${mountpoints[*]}"
+
+
 # todo: check if we have no snapshots yet, because I always want to run
 # archive instead of run. Likely, I should give an error unless a cli
 # override is passed. perhaps check-subvol-stale could give the error.
 # todo: check if we have no snapshots yet, because I always want to run
 # archive instead of run. Likely, I should give an error unless a cli
 # override is passed. perhaps check-subvol-stale could give the error.
@@ -674,14 +701,6 @@ cat >/etc/btrbk$conf_suf.conf <<EOF
 ssh_identity /q/root/h
 #ssh_identity /root/.ssh/home
 
 ssh_identity /q/root/h
 #ssh_identity /root/.ssh/home
 
-# Just a guess that local7 is a good facility to pick.
-# It's a bit odd that the transaction log has to be logged to
-# a file or syslog, while other output is sent to std out.
-# The man does not mention a way for them to be together, but
-# I dunno if setting a log level like warn might also output
-# transaction info.
-transaction_syslog local7
-
 # trying this out
 #stream_compress zstd
 
 # trying this out
 #stream_compress zstd
 
@@ -711,7 +730,7 @@ target_preserve_min 6h
 incremental_prefs sao:1
 
 # if something fails and it's not obvious, try doing
 incremental_prefs sao:1
 
 # if something fails and it's not obvious, try doing
-# btrbk -l debug -v dryrun
+# btrbk -l trace -v dryrun
 
 rate_limit $rate_limit
 EOF
 
 rate_limit $rate_limit
 EOF
@@ -848,7 +867,7 @@ if $dry_run; then
 fi
 # -q and just using the syslog option seemed nice,
 # but it doesn't show when a send has a parent and when it doesn't.
 fi
 # -q and just using the syslog option seemed nice,
 # but it doesn't show when a send has a parent and when it doesn't.
-m btrbk -c /etc/btrbk$conf_suf.conf $preserve_arg $verbose_arg $progress_arg $cmd_arg
+logq btrbk -c /etc/btrbk$conf_suf.conf $preserve_arg $verbose_arg $progress_arg $cmd_arg
 
 if $early; then
   exit 0
 
 if $early; then
   exit 0
@@ -877,10 +896,10 @@ for mp in "${mountpoints[@]}"; do
   subvols+=("${mp##*/}")
 done
 if [[ $source ]]; then
   subvols+=("${mp##*/}")
 done
 if [[ $source ]]; then
-  m mount-latest-subvol "${subvols[@]}"
+  d mount-latest-subvol "${subvols[@]}"
 else
   for tg in ${targets[@]}; do
 else
   for tg in ${targets[@]}; do
-    m /a/exe/mount-latest-remote "$tg" "${subvols[@]}" || ret=$?
+    d /a/exe/mount-latest-remote "$tg" "${subvols[@]}" || ret=$?
   done
 fi
 
   done
 fi
 
@@ -889,7 +908,7 @@ if [[ $ret == 0 ]]; then
   for tg in ${targets[@]}; do
     h=$(ssh $tg hostname)
     if [[ $h == kd && $HOSTNAME == x3 && $HOSTNAME == "$MAIL_HOST" ]]; then
   for tg in ${targets[@]}; do
     h=$(ssh $tg hostname)
     if [[ $h == kd && $HOSTNAME == x3 && $HOSTNAME == "$MAIL_HOST" ]]; then
-      m ssh root@$tg 'btrbk-spread-wrap &>/dev/null </dev/null &'
+      d ssh root@$tg 'btrbk-spread-wrap &>/dev/null </dev/null &'
     fi
     rsync --mkpath -a -f"- */" -f"+ *" /var/log/btrbk/ root@$tg:/var/log/btrbk/$tg
     cmd=/usr/local/bin/mail-backup-clean
     fi
     rsync --mkpath -a -f"- */" -f"+ *" /var/log/btrbk/ root@$tg:/var/log/btrbk/$tg
     cmd=/usr/local/bin/mail-backup-clean
index 85f2f349711dd92584430c059acffd4071d2aa46..f50f5494e2aba068fb68aa2bd51f748b87d358a7 100755 (executable)
@@ -57,12 +57,10 @@ check-idle() {
   export XAUTHORITY=/home/iank/.Xauthority
   export DISPLAY=:0
   locked=false
   export XAUTHORITY=/home/iank/.Xauthority
   export DISPLAY=:0
   locked=false
-  if lock_info=$(xscreensaver-command -time); then
+  if lock_info=$(xscreensaver-command -time 2>/dev/null); then
     if [[ $lock_info != *non-blanked* ]]; then
       locked=true
     fi
     if [[ $lock_info != *non-blanked* ]]; then
       locked=true
     fi
-  else
-    locked=true
   fi
 }
 
   fi
 }
 
index 59e50d595efa3b4935707ab86e3d827ab7c2f1d7..74bbdffaae42ce830c1fa795bb966d8d7ecf4e3f 100755 (executable)
@@ -553,7 +553,7 @@ fi
 # disabled temporarily
 ###### setup /i
 # if home_network; then
 # disabled temporarily
 ###### setup /i
 # if home_network; then
-#   tu /etc/fstab <<'EOF'
+#   sudo /a/exe/teeu /etc/fstab <<'EOF'
 # /i/w  /w  none  bind,noauto  0 0
 # /i/k  /k  none  bind,noauto  0 0
 # EOF
 # /i/w  /w  none  bind,noauto  0 0
 # /i/k  /k  none  bind,noauto  0 0
 # EOF
@@ -562,11 +562,11 @@ fi
 #     sudo chown $USER:user2 /kr
 #   fi
 #   if [[ $HOSTNAME == frodo ]]; then
 #     sudo chown $USER:user2 /kr
 #   fi
 #   if [[ $HOSTNAME == frodo ]]; then
-#     tu /etc/fstab <<'EOF'
+#     sudo /a/exe/teeu /etc/fstab <<'EOF'
 # /k  /kr  none  bind,noauto  0 0
 # EOF
 #   else
 # /k  /kr  none  bind,noauto  0 0
 # EOF
 #   else
-#     tu /etc/fstab <<'EOF'
+#     sudo /a/exe/teeu /etc/fstab <<'EOF'
 # frodo:/k  /kr  nfs  noauto  0 0
 # EOF
 #   fi
 # frodo:/k  /kr  nfs  noauto  0 0
 # EOF
 #   fi
@@ -636,7 +636,7 @@ if has_btrfs; then
     fi
 
     first_root_crypt=$(awk '$2 == "/" {print $1}' /etc/mtab)
     fi
 
     first_root_crypt=$(awk '$2 == "/" {print $1}' /etc/mtab)
-    tu /etc/fstab <<EOF
+    sudo /a/exe/teeu /etc/fstab <<EOF
 $first_root_crypt  /nocow  btrfs  noatime,subvol=nocow$( (( $(nproc) > 2)) && echo ,compress=zstd )  0 0
 EOF
     sudo mkdir -p $dir
 $first_root_crypt  /nocow  btrfs  noatime,subvol=nocow$( (( $(nproc) > 2)) && echo ,compress=zstd )  0 0
 EOF
     sudo mkdir -p $dir
@@ -649,7 +649,7 @@ fi
 
 case $HOSTNAME in
   kd)
 
 case $HOSTNAME in
   kd)
-    tu /etc/fstab <<'EOF'
+    sudo /a/exe/teeu /etc/fstab <<'EOF'
 /dev/mapper/crypt_dev_ata-Samsung_SSD_870_QVO_8TB_S5VUNG0N900656V-part7  /d  btrfs  nofail,x-systemd.device-timeout=30s,x-systemd.mount-timeout=30s,noatime,compress=zstd,subvol=d  0 0
 /d/m /i  none  bind,compress=zstd  0 0
 EOF
 /dev/mapper/crypt_dev_ata-Samsung_SSD_870_QVO_8TB_S5VUNG0N900656V-part7  /d  btrfs  nofail,x-systemd.device-timeout=30s,x-systemd.mount-timeout=30s,noatime,compress=zstd,subvol=d  0 0
 /d/m /i  none  bind,compress=zstd  0 0
 EOF
@@ -665,7 +665,7 @@ EOF
     fi
     ;;
   frodo)
     fi
     ;;
   frodo)
-    tu /etc/fstab <<'EOF'
+    sudo /a/exe/teeu /etc/fstab <<'EOF'
 /dev/mapper/crypt_dev_ata-ata-Hitachi_HDS722020ALA330_JK1121YAG7SXWS-part1  /i  btrfs  nofail,x-systemd.device-timeout=30s,x-systemd.mount-timeout=30s,noatime,subvol=i  0 0
 EOF
     if ! mountpoint /i &>/dev/null; then
 /dev/mapper/crypt_dev_ata-ata-Hitachi_HDS722020ALA330_JK1121YAG7SXWS-part1  /i  btrfs  nofail,x-systemd.device-timeout=30s,x-systemd.mount-timeout=30s,noatime,subvol=i  0 0
 EOF
     if ! mountpoint /i &>/dev/null; then
index ba0b585482efd636a10dde0c64c5ba7060d110a7..d99e6a14e84a864fdb73507b76d42fba6def310c 100755 (executable)
@@ -18,8 +18,8 @@
 
 # SPDX-License-Identifier: GPL-3.0-or-later
 
 
 # SPDX-License-Identifier: GPL-3.0-or-later
 
-# shellcheck source=./brc
-source ~/brc
+export LC_USEBASHRC=t
+source /a/bin/ds/.bashrc
 
 ### setup
 source /a/bin/bash-bear-trap/bash-bear
 
 ### setup
 source /a/bin/bash-bear-trap/bash-bear
@@ -1900,7 +1900,7 @@ case $HOSTNAME in
       wgip=$(command sudo sed -rn 's,^ *Address *= *([^/]+).*,\1,p' /etc/wireguard/wghole.conf)
       # old filename. remove once all hosts are updated.
       s rm -fv /etc/apache2/sites-enabled/${HOSTNAME}wg.b8.nz.conf
       wgip=$(command sudo sed -rn 's,^ *Address *= *([^/]+).*,\1,p' /etc/wireguard/wghole.conf)
       # old filename. remove once all hosts are updated.
       s rm -fv /etc/apache2/sites-enabled/${HOSTNAME}wg.b8.nz.conf
-      web-conf -i -a $wgip -p 9101 -f 9100 - apache2 ${HOSTNAME}wg.b8.nz <<'EOF'
+      s bash -x web-conf -i -a $wgip -p 9101 -f 9100 - apache2 ${HOSTNAME}wg.b8.nz <<'EOF'
 <Location "/">
 AuthType Basic
 AuthName "basic_auth"
 <Location "/">
 AuthType Basic
 AuthName "basic_auth"
index 279151f22da8d9edf885a84df6e156766ffc4c96..6d5e59301bc8978a88089967e625426db7b2038c 100755 (executable)
@@ -74,7 +74,7 @@ t4() {
       pn $d1$d2
       used[$d1$d2]=t
     done
       pn $d1$d2
       used[$d1$d2]=t
     done
-  done
+  done | sort -n
 }
 
 for t in {1..4}; do
 }
 
 for t in {1..4}; do
diff --git a/ffs b/ffs
new file mode 100755 (executable)
index 0000000..253b83b
--- /dev/null
+++ b/ffs
@@ -0,0 +1,96 @@
+#!/bin/bash
+# I, Ian Kelling, follow the GNU license recommendations at
+# https://www.gnu.org/licenses/license-recommendations.en.html. They
+# recommend that small programs, < 300 lines, be licensed under the
+# Apache License 2.0. This file contains or is part of one or more small
+# programs. If a small program grows beyond 300 lines, I plan to change
+# to a recommended GPL license.
+
+# Copyright 2024 Ian Kelling
+
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+#     http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# ffs = ffmpeg stream
+
+# todo: figure out how to record mumble
+# todo: get icecast on li.b8.nz
+# todo: https://superuser.com/questions/1106674/how-to-add-blank-lines-above-the-bottom-in-terminal
+
+if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
+shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
+set -eE -o pipefail
+trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" exit status: $?, PIPESTATUS: ${PIPESTATUS[*]}" >&2' ERR
+
+
+# 3 mountpoints: fsf-sysops (public), fsf (default, all staff), fsf-tech (tech team)
+case $1 in
+  sysops|tech)
+    mount_suffix=-$1
+    ;;
+esac
+
+host=live.iankelling.org:8000
+if [[ $(dig +short @10.2.0.1 -x 10.2.0.2 2>&1 ||:) == kd.b8.nz. ]] \
+     && ip n show 10.2.0.1 | grep . &>/dev/null; then
+  host=127.0.0.1:8000
+fi
+
+pass=$(sed -n 's/ *<source-password>\([^<]*\).*/\1/p' /p/c/icecast.xml)
+
+
+tmpf=$(mktemp)
+xrandr >$tmpf
+
+# example xrandr output: 1280x800+0+0
+primary_res=$(awk '$2 == "connected" && $3 == "primary" { print $4 }' $tmpf | sed 's/+.*//')
+secondary_res=$(awk '$2 == "connected" && $3 != "primary" { print $3 }' $tmpf | sed 's/+.*//')
+
+if [[ $secondary_res ]]; then
+  # assumes secondary is on the right
+  x_offset=${primary_res%%x*}
+  secondary_x=${secondary_res%%x*}
+  secondary_y=${secondary_res##*x}
+  stream_res=$(( secondary_x / 2 ))x$(( secondary_y / 2))
+else
+  x_offset=0
+  stream_res=$primary_res
+fi
+
+
+opts=(
+  # nice to have: be a little less verbose
+  -hide_banner
+  -video_size $stream_res
+  -f x11grab
+  -framerate 4
+  # input options come before -i
+  -i :0.0+$x_offset.0
+  -vf drawbox=color=black
+  -vcodec libvpx
+  -g 8
+  -quality realtime
+  -threads 2
+  -error-resilient 1
+  -content_type video/webm
+  -f webm
+  icecast://source:$pass@$host/fsf$mount_suffix.webm
+
+)
+
+
+rm -f /tmp/iank-ffmpeg
+mkfifo -m 0600 /tmp/iank-ffmpeg
+echo executing: ffmpeg -stdin ${opts[@]}
+# ffmpeg sits and waits until we do this. dunno why. whatever.
+echo >/tmp/iank-ffmpeg &
+ffmpeg ${opts[@]} </tmp/iank-ffmpeg
index 80f2371beaa40a6824ab1f719f12d5d9741c753f..7892cc7cafcc2838882dd39a62bae1f0084a842a 100755 (executable)
@@ -48,8 +48,8 @@ else
   firefox "$@" &
 fi
 
   firefox "$@" &
 fi
 
-# .5 was too fast
-sleep 1
+# on a fast computer, .5 is too fast, 1 is ok. on x200, 1 is too fast, 2 is ok.
+sleep 2
 # debug
 #printf "%s\n" "$*" >> /tmp/a
 if (( $# == 0 )) && ! i3-msg -t get_tree | jq --stream -r 'select(.[1]|scalars!=null) | "\(.[0]|join(".")): \(.[1]|tojson)"'  | grep 'marks.0: "abrowser"$' &>/dev/null; then
 # debug
 #printf "%s\n" "$*" >> /tmp/a
 if (( $# == 0 )) && ! i3-msg -t get_tree | jq --stream -r 'select(.[1]|scalars!=null) | "\(.[0]|join(".")): \(.[1]|tojson)"'  | grep 'marks.0: "abrowser"$' &>/dev/null; then
@@ -60,7 +60,7 @@ if (( $# == 0 )) && ! i3-msg -t get_tree | jq --stream -r 'select(.[1]|scalars!=
   # into a single array instead of a list of arrays with [.[]], or else
   # it will add the arrays a bunch of times and give several results.
   # comm gives us just the new id.
   # into a single array instead of a list of arrays with [.[]], or else
   # it will add the arrays a bunch of times and give several results.
   # comm gives us just the new id.
-  id=$(i3-msg -t get_tree | jq -e '.nodes[].nodes[].nodes[].nodes | [.[]] + ( [.[].nodes[]]) | .[] | select(.window_properties.class=="abrowser") | .id' | comm -23 - $tmpf | head -n1)
+  id=$(i3-msg -t get_tree | jq -e '.nodes[].nodes[].nodes[].nodes | [.[]] + ( [.[].nodes[]]) + ( [.[].nodes[].nodes[]]) + ( [.[].nodes[].nodes[].nodes[]]) | .[] | select(.window_properties.class=="abrowser") | .id' | comm -23 - $tmpf | head -n1)
   rm -f $tmpf
   if [[ $id ]]; then
     i3-msg "[con_id=$id] mark abrowser"
   rm -f $tmpf
   if [[ $id ]]; then
     i3-msg "[con_id=$id] mark abrowser"
diff --git a/filesystem/usr/local/bin/ethusb-nm b/filesystem/usr/local/bin/ethusb-nm
deleted file mode 100644 (file)
index 041124e..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-# I, Ian Kelling, follow the GNU license recommendations at
-# https://www.gnu.org/licenses/license-recommendations.en.html. They
-# recommend that small programs, < 300 lines, be licensed under the
-# Apache License 2.0. This file contains or is part of one or more small
-# programs. If a small program grows beyond 300 lines, I plan to switch
-# its license to GPL.
-
-# Copyright 2024 Ian Kelling
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
-shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
-
-[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
-
-
-sed -i --follow-symlinks '/^[^#/]/s/^/#/' /etc/network/interfaces.d/ethusb
diff --git a/filesystem/usr/local/bin/ethusb-static b/filesystem/usr/local/bin/ethusb-static
deleted file mode 100644 (file)
index 97868d7..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/bash
-# I, Ian Kelling, follow the GNU license recommendations at
-# https://www.gnu.org/licenses/license-recommendations.en.html. They
-# recommend that small programs, < 300 lines, be licensed under the
-# Apache License 2.0. This file contains or is part of one or more small
-# programs. If a small program grows beyond 300 lines, I plan to switch
-# its license to GPL.
-
-# Copyright 2024 Ian Kelling
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-if ! test "$BASH_VERSION"; then echo "error: shell is not bash" >&2; exit 1; fi
-shopt -s inherit_errexit 2>/dev/null ||: # ignore fail in bash < 4.4
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
-
-[[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@"
-
-
-shopt -s nullglob
-
-# we already configured the interface once, afterwards, comment and
-# uncomment to enable/disable. This makes it so we don't depend on /p
-# being mounted.
-
-if [[ -s /etc/network/interfaces.d/ethusb ]]; then
-  sed -i --follow-symlinks 's/^#//' /etc/network/interfaces.d/ethusb
-  exit 0
-fi
-
-
-while read -r ip host mac; do
-  if [[ $mac != usb ]]; then
-    continue
-  fi
-  if [[ $host = ${HOSTNAME}c ]]; then
-    usbip=$ip
-    break
-  fi
-done </p/c/host-info
-
-if [[ ! $usbip ]]; then
-  exit 0
-fi
-
-ethx=0
-
-# device that has an eth0, but we aren't using it because it is
-# broken. We could just hardcode a mac comparison with `cat
-# /sys/class/net/eth0/address` but this is cooler.
-if [[ -e  /sys/class/net/eth0 ]]; then
-  bus_info=$(ethtool -i eth0 | awk '$1 == "bus-info:" { print $2 }')
-  if [[ $bus_info != usb* ]]; then
-    ethx=1
-  fi
-fi
-
-cat >/etc/network/interfaces.d/ethusb <<EOF
-auto eth$ethx
-iface eth$ethx inet static
-  address 10.2.0.$ip/16
-  gateway 10.2.0.1
-EOF
diff --git a/i3-pull b/i3-pull
index 64f35f7d219b26595c2f4befd6a186232e88fdc5..9d391d531f7f447cbe65f3342d31f2abf95dabbe 100755 (executable)
--- a/i3-pull
+++ b/i3-pull
 # limitations under the License.
 
 
 # limitations under the License.
 
 
-# sometimes I want to pull in and sometimes I want to swap.
+# pull in the $1 marked window to the current workspace, unless the current workspace is #1, then swap it with the current window
 
 set -e; . /usr/local/lib/bash-bear; set +e
 
 mark=$1
 
 set -e; . /usr/local/lib/bash-bear; set +e
 
 mark=$1
+# height of currently focused window
 h=$(i3-msg -t get_tree | jq -r ".. | select(.focused? == true) | .rect.height")
 
 cur_workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused? == true) | .name')
 h=$(i3-msg -t get_tree | jq -r ".. | select(.focused? == true) | .rect.height")
 
 cur_workspace=$(i3-msg -t get_workspaces | jq -r '.[] | select(.focused? == true) | .name')
index 8ad41a1df713ad50c12262b7aa2444c473b4c9d4..017f4bd7fc0f7dc7f13dbdb1efcc5aff4afdafa4 100644 (file)
@@ -63,7 +63,8 @@ bindsym $mod+t layout toggle splith splitv tabbed
 bindsym $mod+Shift+t move workspace to output right
 # there's a bug about this. it is not logical that there is no "split
 # tabbed", but you accomplish that by doing this.
 bindsym $mod+Shift+t move workspace to output right
 # there's a bug about this. it is not logical that there is no "split
 # tabbed", but you accomplish that by doing this.
-bindsym $mod+g split vertical, layout tabbed
+bindsym $mod+g split horizontal, layout tabbed
+bindsym $mod+shift+n layout tabbed
 bindsym $mod+shift+g $ex "/b/ds/i3-auto-layout-toggle"
 
 # Use Mouse+$mod to drag floating windows to their wanted position
 bindsym $mod+shift+g $ex "/b/ds/i3-auto-layout-toggle"
 
 # Use Mouse+$mod to drag floating windows to their wanted position
index aefcee869ff276ed22fb091bf626f02483abfbd9..265a9322cb0f04085e3b668966e6ba7e6ca0b938 100644 (file)
@@ -4,29 +4,29 @@ bindsym $mod+Shift+o exec "i3-nagbar -t warning -m 'You pressed the exit shortcu
 bindsym $mod+Shift+p restart
 
 # need this for kde connect
 bindsym $mod+Shift+p restart
 
 # need this for kde connect
-bar {
+bar {
 
 
-# keep it only on secondary monitor to save space and make for less
-# missing pixes in obs live stream. For docs on this, search "output
-# primary" in the i3 guide.
-output primary
+# keep it only on secondary monitor to save space and make for less
+# missing pixes in obs live stream. For docs on this, search "output
+# primary" in the i3 guide.
+output primary
 
 
-# the builtin prog
-#status_command i3status
+# the builtin prog
+# #status_command i3status
 
 
-#for faster testing
-#status_command          /a/bin/ds/myi3status
-status_command          /usr/local/bin/myi3status
-#mode hide
-# hidden_state hide
-font pango:monospace 18
+# #for faster testing
+# #status_command          /a/bin/ds/myi3status
+status_command          /usr/local/bin/myi3status
+# #mode hide
+# hidden_state hide
+font pango:monospace 18
 
 
-# i have no need for the tray icons so far
-tray_output primary
+# i have no need for the tray icons so far
+tray_output primary
 
 
-# I found I didn't need these, but, I'm trying them out again.
-# workspace_buttons no
-}
+# I found I didn't need these, but, I'm trying them out again.
+# workspace_buttons no
+}
 
 ## dont want to see this bar for now
 # bar {
 
 ## dont want to see this bar for now
 # bar {
index db8eb4490172239783b641b9c510b01ba972e28c..5b30b31e2d6128dfe247a1b8b704e257d85406f3 100755 (executable)
@@ -100,10 +100,10 @@ if set_device_id "Logitech Unifying Device"; then
 fi
 
 ## slow down ploopy trackball, until we recompile firmware
 fi
 
 ## slow down ploopy trackball, until we recompile firmware
-id=$(xinput list | grep -F 'Ploopy Corporation Trackball Mouse' | sed -rn 's/.*[[:space:]]id=([^[:space:]]*).*/\1/p' ||:)
-if [[ $id ]]; then
-#   xinput --set-prop $id  'libinput Accel Speed' -0.9
-fi
+id=$(xinput list | grep -F 'Ploopy Corporation Trackball Mouse' | sed -rn 's/.*[[:space:]]id=([^[:space:]]*).*/\1/p' ||:)
+if [[ $id ]]; then
+  xinput --set-prop $id  'libinput Accel Speed' -0.7
+fi
 
 set +x
 exit 0
 
 set +x
 exit 0
index 4a0891a99821c8d829689b61f28d754b115a21af..28c840e4eadff86b60d8de4b19542e1050ce1992 100755 (executable)
@@ -25,10 +25,19 @@ set -e; . /usr/local/lib/bash-bear; set +e
 
 output=$(xrandr | grep -E "^(HDMI.?|DP1) connected" | awk '{print $1}' ||:)
 
 
 output=$(xrandr | grep -E "^(HDMI.?|DP1) connected" | awk '{print $1}' ||:)
 
+left_right_arg=--right-of
 if [[ $output ]]; then
 if [[ $output ]]; then
+
+  if [[ $output == HDMI2 ]]; then
+    sum=$(sha256sum </sys/class/drm/card0-HDMI-A-2/edid | grep -oE '^.{10}')
+    # identify monitor that is always on the left.
+    if [[ $sum == 192efbdcef ]]; then
+      left_right_arg=--left-of
+    fi
+  fi
   xrandr --output $output --off
   sleep 2
   xrandr --output $output --off
   sleep 2
-  xrandr --output $output --right-of eDP1 --mode 3840x2160
+  xrandr --output $output $left_right_arg eDP1 --mode 3840x2160
 
   for i in 1 2 4 5 6 7 8 9 10; do
     # if the workspace is already there, this will fail
 
   for i in 1 2 4 5 6 7 8 9 10; do
     # if the workspace is already there, this will fail
diff --git a/machine_specific/li/filesystem/etc/openvpn/client-config-hole/bb8 b/machine_specific/li/filesystem/etc/openvpn/client-config-hole/bb8
deleted file mode 100644 (file)
index efe7832..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ifconfig-push 10.5.5.32 255.255.255.0
diff --git a/machine_specific/li/filesystem/etc/openvpn/client-config-hole/frodo b/machine_specific/li/filesystem/etc/openvpn/client-config-hole/frodo
deleted file mode 100644 (file)
index 7fbb17c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-ifconfig-push 10.5.5.34 255.255.255.0
index 16ef1379a025bca200ce6f41c4e098053909d5b3..24af30f0e3790848dba0a9104bc79eeca0f7c2b8 100644 (file)
@@ -1 +1 @@
-ifconfig-push 10.5.5.23 255.255.255.0
+ifconfig-push 10.5.5.28 255.255.255.0
index 8a764b1d519eae011a7edbaa1fc36c308daae1d0..9d386a8acd43531b214fd3a1e2c9cf14d1644657 100644 (file)
@@ -24,10 +24,10 @@ LimitNPROC=10
 # we use .1 to make this be on a different network than kd, so that we can
 # talk to transmission on kd from remote host, and still use this
 # vpn.
 # we use .1 to make this be on a different network than kd, so that we can
 # talk to transmission on kd from remote host, and still use this
 # vpn.
-ExecStartPre=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns -n 10.174.23 start %i
+ExecStartPre=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns -n 10.174.28 start %i
 ExecStartPre=/sbin/iptables-restore /a/bin/distro-setup/transmission-firewall/netns.rules
 # allow wireguard network to connect
 ExecStartPre=/sbin/iptables-restore /a/bin/distro-setup/transmission-firewall/netns.rules
 # allow wireguard network to connect
-ExecStartPre=/usr/sbin/ip r add 10.8.0.0/24 via 10.174.23.1 dev veth1-client
+ExecStartPre=/usr/sbin/ip r add 10.8.0.0/24 via 10.174.28.1 dev veth1-client
 ExecStopPost=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns stop %i
 PrivateNetwork=true
 BindReadOnlyPaths=/etc/tr-resolv:/run/systemd/resolve:norbind /etc/basic-nsswitch:/etc/resolved-nsswitch:norbind
 ExecStopPost=/usr/bin/flock -w 20 /tmp/newns.flock /a/bin/newns/newns stop %i
 PrivateNetwork=true
 BindReadOnlyPaths=/etc/tr-resolv:/run/systemd/resolve:norbind /etc/basic-nsswitch:/etc/resolved-nsswitch:norbind
index 69bde61ce1beb34d0846f7896e2b44b943fef03d..7c0e7d50b6e037ca4737abc8422e0a4b169a8ced 100755 (executable)
@@ -21,6 +21,9 @@
 # limitations under the License.
 
 
 # limitations under the License.
 
 
+# Automatically switch between obs scenes which match i3 window mark
+# names.
+
 set -e; . /usr/local/lib/bash-bear; set +e
 
 try() {
 set -e; . /usr/local/lib/bash-bear; set +e
 
 try() {
diff --git a/pkgs b/pkgs
index ee3efb963e10cd64afdc3491aaad5c5f1f0e264b..97e4e9d1fced1b72fa9fdfb3e8d88cf2ecd5e44d 100644 (file)
--- a/pkgs
+++ b/pkgs
@@ -31,6 +31,7 @@ p1=(
   mbuffer
   moreutils
   screen
   mbuffer
   moreutils
   screen
+  tmux
 )
 p2=(
   bash-completion
 )
 p2=(
   bash-completion
@@ -127,6 +128,7 @@ p3=(
   dos2unix
   dosfstools
   dnsutils
   dos2unix
   dosfstools
   dnsutils
+  dsh
   dunst
   python3-dnspython
   # better du in t11+
   dunst
   python3-dnspython
   # better du in t11+
diff --git a/prof b/prof
index dd9ad3ed2c0b4912d527b6f60efa1ac755c115c2..9cc588099d0f6ff6109445fe9148cdc21e80ae6d 100644 (file)
--- a/prof
+++ b/prof
@@ -41,5 +41,5 @@ if $dossh; then
   konsole --profile profanity
 else
   prof-tail | prof-notify &
   konsole --profile profanity
 else
   prof-tail | prof-notify &
-  konsole --profile profanity -e screen -RD -S profanity
+  konsole --profile profanity -e tmux -L profanity a
 fi
 fi
index 9e436ed8d6dd101ad723843e1cb7eb8550c15b1c..d7363fe208b0cb5007d96c82d70cf6c87d265ff4 100644 (file)
@@ -33,7 +33,7 @@ while true; do
   fi
   # -n or else it competes with the other ssh for reading stdin.
   ssh -n $remote prof-tail | prof-notify &
   fi
   # -n or else it competes with the other ssh for reading stdin.
   ssh -n $remote prof-tail | prof-notify &
-  ssh -t $remote screen -Dr -S profanity ||:
+  ssh -t $remote tmux -L profanity a ||:
   builtin kill %% &> /dev/null ||:
   if (( EPOCHSECONDS > start + 600 )); then
     fastcon=0
   builtin kill %% &> /dev/null ||:
   if (( EPOCHSECONDS > start + 600 )); then
     fastcon=0
index 4767c7d54b76f7dd44d1077498cfd923968ce07d..5395c44ced87fbf7624fdbaff11ca95a4772f675 100755 (executable)
@@ -95,3 +95,5 @@ if [[ ! -e $auth_file ]] || ! diff -q /root/.ssh/authorized_keys $auth_file; the
   cp -p /root/.ssh/authorized_keys $auth_file
   update-initramfs -u -k all
 fi
   cp -p /root/.ssh/authorized_keys $auth_file
   update-initramfs -u -k all
 fi
+
+rsync -tpur /p/c/subdir_files/.dsh /root
index 712da268c8310f553e4da26d113712bd37d0f0cc..e369ceb1c65acd18faec5efca115982d2a5944a3 100644 (file)
@@ -45,6 +45,7 @@ my_bin_files=(
   prof-tail
   prof-notify
   /a/bin/newns/newns
   prof-tail
   prof-notify
   /a/bin/newns/newns
+  /a/bin/fai/fai/config/distro-install-common/ethusb-static
 )
 
 for f in /b/log-quiet/*; do
 )
 
 for f in /b/log-quiet/*; do
index ed713cd2f9ee1ec89d35a7c5a3e1b02f9220bd19..b7b9a058056b573061475a7814862fa6962ceccd 100644 (file)
@@ -11,8 +11,11 @@ Description=profanity
 After=gpg-agent.service
 
 [Service]
 After=gpg-agent.service
 
 [Service]
-# bash is required to get colors working
-ExecStart=/usr/bin/screen -S profanity -Dm /bin/bash -c profanity
+# tmux requirement
+Type=forking
+
+# new-session is a tmux command which allows launching profanity.
+ExecStart=/usr/bin/tmux -L profanity new-session -d profanity
 
 [Install]
 WantedBy=default.target
 
 [Install]
 WantedBy=default.target
index 035415df83672cfebdb6c4f55b9064771f4295ae..8c6a6f10ef3491cad430266005c5f61b6ce89df0 100644 (file)
@@ -46,9 +46,9 @@ default-key B125F60B7B287FF6A2B7DF8F170AF0E2954295DF
 #keyserver hkp://keys.gnupg.net
 #keyserver hkp://keyserver.ubuntu.com
 #keyserver hkp://keyring.debian.org
 #keyserver hkp://keys.gnupg.net
 #keyserver hkp://keyserver.ubuntu.com
 #keyserver hkp://keyring.debian.org
-#keyserver keyserver.ubuntu.com
+keyserver keyserver.ubuntu.com
 # more secure hkps, but had problems with my gpg version
 # more secure hkps, but had problems with my gpg version
-keyserver hkps://hkps.pool.sks-keyservers.net
+#keyserver hkps://hkps.pool.sks-keyservers.net
 
 ### begin things added by enigmail
 cert-digest-algo SHA256
 
 ### begin things added by enigmail
 cert-digest-algo SHA256
index d6269d9c825f89b30a67cc5cb7e1f3512f278dfa..ae37d3b02cf26782d07ac1a90019403d0c1699d0 100755 (executable)
@@ -440,32 +440,30 @@ mute() {
   local locked
   export DISPLAY=:0
   locked=false
   local locked
   export DISPLAY=:0
   locked=false
-  if lock_info=$(xscreensaver-command -time); then
+  if lock_info=$(xscreensaver-command -time 2>/dev/null); then
     if [[ $lock_info != *non-blanked* ]]; then
       locked=true
     fi
     if [[ $lock_info != *non-blanked* ]]; then
       locked=true
     fi
-  else
-    locked=true
-  fi
-  midnight=$(date -d 00:00 +%s)
-  mdiff=$(( EPOCHSECONDS - midnight ))
-  if $locked && (( mdiff < 6 *60*60 || mdiff > 21 *60*60 )); then
-    case $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') in
-      no)
-        # for log purposes
-        echo muted
-        pactl set-sink-mute @DEFAULT_SINK@ true
-        ;;
-    esac
-  fi
-  if ! $locked && ((  mdiff > 6 *60*60 || mdiff < 12 *60*60 )) && [[ ! -e /tmp/ianknap ]]; then
-    case $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') in
-      yes)
-        # for log purposes
-        echo unmuted
-        pactl set-sink-mute @DEFAULT_SINK@ false
-        ;;
-    esac
+    midnight=$(date -d 00:00 +%s)
+    mdiff=$(( EPOCHSECONDS - midnight ))
+    if $locked && (( mdiff < 6 *60*60 || mdiff > 21 *60*60 )); then
+      case $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') in
+        no)
+          # for log purposes
+          echo muted
+          pactl set-sink-mute @DEFAULT_SINK@ true
+          ;;
+      esac
+    fi
+    if ! $locked && ((  mdiff > 6 *60*60 || mdiff < 12 *60*60 )) && [[ ! -e /tmp/ianknap ]]; then
+      case $(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}') in
+        yes)
+          # for log purposes
+          echo unmuted
+          pactl set-sink-mute @DEFAULT_SINK@ false
+          ;;
+      esac
+    fi
   fi
 }
 
   fi
 }