From: Ian Kelling Date: Sun, 1 Mar 2026 08:32:09 +0000 (-0500) Subject: improvements X-Git-Url: https://iankelling.org/git/?a=commitdiff_plain;h=a76c5ba5099aa2a5e936df1856b8344aba73a333;p=distro-setup improvements --- diff --git a/brc b/brc index 2f88b8a..b1b3fe3 100644 --- a/brc +++ b/brc @@ -2347,17 +2347,17 @@ k() { local grep_out1 grep_out2 histf1 histf2 local -a lines1 lines2 histf1=${HISTFILE:-~/.bash_history} - grep_out1=$(grep -iP --binary-files=text "$@" $histf1 | tail -n 80) || [[ $? == 1 ]] + grep_out1=$(grep -iP --binary-files=text "$*" $histf1 | tail -n 80) || [[ $? == 1 ]] if [[ $EUID == 0 ]]; then histf2="/home/iank/.bh" - grep_out2=$(grep -iP --binary-files=text "$@" $histf2 | tail -n 80) || [[ $? == 1 ]] + grep_out2=$(grep -iP --binary-files=text "$*" $histf2 | tail -n 80) || [[ $? == 1 ]] elif sudo -nv 2>/dev/null; then histf2="/root/.bh" - grep_out2=$(sudo grep -iP --binary-files=text "$@" $histf2 | tail -n 80) || [[ $? == 1 ]] + grep_out2=$(sudo grep -iP --binary-files=text "$*" $histf2 | tail -n 80) || [[ $? == 1 ]] fi + mapfile -t lines1 <<<"$grep_out1" + mapfile -t lines2 <<<"$grep_out2" if [[ $grep_out1 && $grep_out2 ]]; then - mapfile -t lines1 <<<"$grep_out1" - mapfile -t lines2 <<<"$grep_out2" # in this case, just insert a chunk of secondary results in the middle. if (( ${#lines1[@]} > 20 )); then printf "%s\n" "${lines1[@]:20}"; printf "############ ^ %s #############\n" $histf1 @@ -3446,11 +3446,7 @@ sl() { # But, since we are doing all this, lets source it because we can. cat <(echo . $sync_dirname/.bashrc) - | command ssh "${args[@]}" "$remote" LC_USEBASHRC=t bash else - # random deletable note: This ssh corresponds to the one below - # with reverse tunnel below, and it would make sense to add it - # here too, but I'm mainly interested in collecting history from - # skip type hosts,so leaving it out for now. - mq command ssh -t "${args[@]}" "$remote" LC_USEBASHRC=t INPUTRC=$sync_dirname/.inputrc bash --rcfile $sync_dirname/.bashrc + mq command ssh -R localhost:36660:localhost:36661 -t "${args[@]}" "$remote" LC_USEBASHRC=t INPUTRC=$sync_dirname/.inputrc bash --rcfile $sync_dirname/.bashrc fi else if [[ -t 0 ]]; then @@ -3473,8 +3469,10 @@ hist-catcher() { local cmd_regex='[[:alnum:]]' while true; do - cmd=$(nc -l 36661) ||: - e "cmd:'$cmd'"; + cmd=$(nc -l 36661) || sleep 1 + if [[ $verbose == true ]]; then + e "cmd:'$cmd'"; + fi if [[ ! $cmd =~ $cmd_regex ]]; then continue fi diff --git a/brc2 b/brc2 index 2812415..b862fbb 100644 --- a/brc2 +++ b/brc2 @@ -2579,6 +2579,20 @@ sudm() { fi } +_in_rootns() { + local tmps a b + tmps=$(s readlink /proc/1/ns/net /proc/$$/ns/net) + { read -r a; read -r b; } <<<"$tmps" + if [[ ! $b ]]; then + e "error: _in_rootns failed to get current netns" + return 1 + fi + if [[ $a != "$b" ]]; then + e "error: _in_rootns: not in the root netns. return 1" + return 1 + fi +} + mns-setup() { local ns ns=$1 @@ -2603,6 +2617,8 @@ mns-no-setup() { local ns ns=$1 shift + _in_rootns + m sudm /usr/bin/nsenter --mount=/root/mount_namespaces/$ns "$@" } @@ -2610,13 +2626,17 @@ mns() { # mount namespace local ns ns=$1 shift + _in_rootns + mns-setup $ns m sudm /usr/bin/nsenter --mount=/root/mount_namespaces/$ns "$@" } mnsr() { # mns run (as normal user) - local ns pre_check tmpf user alt_user=false + local ns pre_check tmpf user alt_user=false tmps + _in_rootns + user=$USER while [[ $1 ]]; do case $1 in @@ -2657,6 +2677,7 @@ mnsr() { # mns run (as normal user) mnsd() { # mount namespace + systemd network namespace local ns unit user tmpf pre_check pid alt_user=false local -a final_args + _in_rootns ## begin command line args ## user=$USER @@ -2699,6 +2720,7 @@ mnsd() { # mount namespace + systemd network namespace mnsnonetroot() { ns=$1 + _in_rootns lomh if ! s ip netns list | grep -Fx nonet &>/dev/null; then s ip netns add nonet @@ -2709,6 +2731,7 @@ mnsnonetroot() { mnsnonet() { ns=$1 + _in_rootns lomh if ! s ip netns list | grep -Fx nonet &>/dev/null; then s ip netns add nonet @@ -2721,6 +2744,7 @@ mnsnonet() { lom() { # l = the loopback device local l base + _in_rootns # get sudo pass cached right away if ! sudo -nv 2>/dev/null; then sudo -v diff --git a/distro-end b/distro-end index ee294aa..ffdaf3e 100755 --- a/distro-end +++ b/distro-end @@ -2235,6 +2235,22 @@ case $HOSTNAME in ;; esac +# misc +sgo system-status +sgo hist-catcher + +# console font size +if [[ $HOSTNAME == sf ]] && ! grep -q '^FONTFACE="TER"' /etc/default/console-setup; then + sudo sed -i '/^FONTFACE/s/^/#/' /etc/default/console-setup # comment out the old value + sudo sed -i '/^FONTSIZE/s/^/#/' /etc/default/console-setup # comment out the old value + echo 'FONTFACE="TER"' | sudo tee -a /etc/default/console-setup # Set font to Terminus + echo 'FONTSIZE="16x32"' | sudo tee -a /etc/default/console-setup # Set font size + pi xfonts-terminus + update-initramfs -u +fi + +sudo chown -R iank:iank /etc/i3 + ### Anki notes # Distro version is too old to be compatible with f-droid, so I installed upstream. # However, the way the recommend doing that is annoying to automate, so I'm leaving it diff --git a/i3-sway/gen b/i3-sway/gen index 2a6c3a8..2ddd98d 100755 --- a/i3-sway/gen +++ b/i3-sway/gen @@ -43,7 +43,11 @@ rm -f ~/.config/i3/config f=/etc/i3/config if [[ -e /etc/i3 && ! -w /etc/i3 ]]; then - sudo chown -R iank:iank /etc/i3 + if [[ -t 0 ]]; then + sudo chown -R iank:iank /etc/i3 + else + echo "error: please chown -R iank:iank /etc/i3" + fi fi cat common.conf i3.conf "$(if [[ -s ~/i3-myx.conf ]]; then echo ~/i3-myx.conf; fi)" >$f diff --git a/machine_specific/frodo/filesystem/etc/btrbk/r5.conf b/machine_specific/frodo/filesystem/etc/btrbk/r5.conf index 3689b26..e3e3129 100644 --- a/machine_specific/frodo/filesystem/etc/btrbk/r5.conf +++ b/machine_specific/frodo/filesystem/etc/btrbk/r5.conf @@ -17,3 +17,6 @@ rate_limit no volume /mnt/r5 subvolume d subvolume r +subvolume rbase +subvolume rjson +subvolume mhot diff --git a/script-files b/script-files index b245ef2..ce48c9e 100644 --- a/script-files +++ b/script-files @@ -39,6 +39,7 @@ done my_service_scripts=( epanic-clean system-status + hist-catcher btrfsmaint mailtest-check dynamic-ip-update diff --git a/subdir_files/.config/konsolerc b/subdir_files/.config/konsolerc index c123bee..d81c9ce 100644 --- a/subdir_files/.config/konsolerc +++ b/subdir_files/.config/konsolerc @@ -23,6 +23,11 @@ ShowMenuBarByDefault=false 2 screens: Width=1916 2 screens: XPosition=2 2 screens: YPosition=2 +3840x2160 screen: Height=2156 +3840x2160 screen: Width=1276 +3840x2160 screen: XPosition=1282 +3840x2160 screen: YPosition=2 +DP-0=DP-0 DP-1 eDP-1=DP-1 DP-1-1 eDP-1=DP-1-1 DP-1-3 eDP-1=eDP-1