From 161a5c8c82396d55e4cb9e7d01233f03559cd0df Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Mon, 8 Jul 2024 14:09:08 -0400 Subject: [PATCH] various improvements --- brc | 39 ++++++++++++------- brc2 | 27 ++++++++++--- distro-end | 8 +++- rootsshsync | 2 +- .../share/applications/chromium.desktop | 13 ------- .../.local/share/applications/firefox.desktop | 13 ------- 6 files changed, 55 insertions(+), 47 deletions(-) delete mode 100644 subdir_files/.local/share/applications/chromium.desktop delete mode 100644 subdir_files/.local/share/applications/firefox.desktop diff --git a/brc b/brc index 105d754..37733f3 100644 --- a/brc +++ b/brc @@ -1316,14 +1316,27 @@ ediff() { emacs --eval "(ediff-files \"$1\" \"$2\")" } +rspamta() { + ta "$@" /var/log/rspamd/rspamd.log + } + + +_rspamtag() { + tailf /var/log/rspamd/rspamd.log | grp "$@" + } +rspamtag() { + bn _rspamtag "$@" +} + + # etail + grep. -etailg() { - _bntmp() { +_etailg() { ngset tailf /var/log/exim4/mainlog /var/log/exim4/*main /var/log/exim4/paniclog /var/log/exim4/*panic -n 200 | grp "$@" ngreset } - bn _bntmp "$@" +etailg() { + bn _etailg "$@" } # mail related # shellcheck disable=SC2120 # we expect to pass arguments in use outside this file @@ -1352,13 +1365,13 @@ tailf() { ta() { bn tailf "$@" } +_tag() { + local file + file="$1" + tailf "$file" | gr --line-buffered "$@" +} tag() { - _bntmp() { - local file - file="$1" - tailf "$file" | gr --line-buffered "$@" - } - bn _bntmp "$@" + bn _tag "$@" } ccomp tail etail etail2 ta @@ -1983,20 +1996,20 @@ jrt() { journalctl -e -n100000 -o short-full "$@"; } jr() { journalctl -e -n100000 "$@" ; } jrf() { SYSTEMD_COLORS=true bn journalctl -n1000 -f "$@" ; } jrfg() { - _bntmp() { SYSTEMD_COLORS=true journalctl -n1000 -f | grp "$@"; } - bn _bntmp "$@" + _jrfg() { SYSTEMD_COLORS=true journalctl -n1000 -f | grp "$@"; } + bn _jrfg "$@" } jru() { SYSTEMD_COLORS=true bn journalctl -n1000 -f -u "$@" ; } jrug() { - _bntmp() { + _jrug() { local unit unit="$1" shift SYSTEMD_COLORS=true journalctl -n1000 -f -u "$unit" | grp "$@" } - bn _bntmp "$@" + bn _jrug "$@" } ccomp journalctl jr jrf jru diff --git a/brc2 b/brc2 index 6b2b5a3..6b41bc1 100644 --- a/brc2 +++ b/brc2 @@ -3100,8 +3100,8 @@ mnsd() { # mount namespace + systemd namespace export -p >$tmpf printf "%s " "${@@Q}" >>$tmpf echo >>$tmpf - - m sudo nsenter -t $pid -n --mount=/root/mount_namespaces/$ns sudo -u $USER -i bash -c ". $tmpf & sleep 1; rm $tmpf" + echo "rm -f $tmpf" >>$tmpf + m sudo nsenter -t $pid -n --mount=/root/mount_namespaces/$ns sudo -u $USER -i bash -c ". $tmpf" } @@ -3803,9 +3803,18 @@ spamf() { # spamtest on FILE spamd_ser=spamassassin fi sdncmdroot $spamd_ser sudo -u Debian-exim spamassassin -t --cf='score PYZOR_CHECK 0' <"$1" -} + # rspamc. This has a bit of a problem where it always says hostname not recognized. + # I haven't figured out how to fix it, but I know that it expects to get that hostname + # from exim, and maybe the only way to do it properly is to actually pass the email + # through exim and tell exim the host. + #sdncmd rspamd rspamc "$1" + + # if we made rspamc listen on other addresses, we could do + #rspamc -h 10.173.8.2:11334 "$1" +} + # mail related testmail() { declare -gi _seq; _seq+=1 @@ -4124,7 +4133,8 @@ sdncmd() { export -p >$tmpf printf "%s " "${@@Q}" >>$tmpf echo >>$tmpf - m sudo nsenter -t $pid -n -m sudo -u $USER -i bash -c ". $tmpf & rm $tmpf" + echo "rm -f $tmpf" >>$tmpf + m sudo nsenter -t $pid -n -m sudo -u $USER -i bash -c ". $tmpf" } sdncmdroot() { # systemd namespace root command @@ -4155,12 +4165,13 @@ sdnncmd() { export -p >$tmpf printf "%s " "${@@Q}" >>$tmpf echo >>$tmpf - m sudo nsenter -t $pid -n sudo -u $USER -i bash -c ". $tmpf & rm $tmpf" + echo "rm -f $tmpf" >>$tmpf + m sudo nsenter -t $pid -n sudo -u $USER -i bash -c ". $tmpf" } mailnnbash() { - sdnbash mailnn + sdnbashroot mailnn } # we use wireguard now, use mailnnbash. @@ -4473,6 +4484,10 @@ rgm() { rem() { local paths local -a opts + if [[ ! $1 ]]; then + echo rem: missing argument >&2 + return 1 + fi for arg; do if [[ $arg == -* ]]; then opts+=("$1") diff --git a/distro-end b/distro-end index 30bb4ec..56fc735 100755 --- a/distro-end +++ b/distro-end @@ -1750,11 +1750,17 @@ DEVICESCAN -a -o on -S on -n standby,q $sched \ # see current with: # xdg-settings get default-web-browser -# not sure this is needed. will add other distros if necessary +# not sure this is needed. +# +# These are some old files that made xdg-open open firefox from a chroot. +rm -f ~/.local/share/applications/{firefox,chromium}* case $distro in trisquel) xdg-settings set default-web-browser abrowser.desktop ;; + ubuntu) + xdg-settings set default-web-browser firefox.desktop + ;; esac diff --git a/rootsshsync b/rootsshsync index afa71b5..1c9492a 100755 --- a/rootsshsync +++ b/rootsshsync @@ -67,7 +67,7 @@ if [[ -e $user_ssh_dir/config ]]; then # forgetting to use confighome, and then after specifying it, # it uses the multiplex socket, which means that the different # key in confighome is not actually used unless we do ssh -O exit HOST. - sed 's,^IdentityFile ~/\.ssh/home$,IdentityFile ~/\.ssh/h\nControlPath ${HOME}/.chssh_%u_%h_%p_%r,' /root/.ssh/confighome >/root/.ssh/config + sed 's,^IdentityFile ~/\.ssh/home$,IdentityFile ~/\.ssh/h\nControlPath /root/.chssh_%u_%h_%p_%r,;s/ControlMaster autoask/ControlMaster auto/' /root/.ssh/confighome >/root/.ssh/config fi chown -R root:root /root/.ssh diff --git a/subdir_files/.local/share/applications/chromium.desktop b/subdir_files/.local/share/applications/chromium.desktop deleted file mode 100644 index 260cb7d..0000000 --- a/subdir_files/.local/share/applications/chromium.desktop +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env xdg-open -# ian: note, this is linked to from ~/.config/menus/mate-applications.menu -[Desktop Entry] -Version=1.0 -Type=Application -Terminal=false -Icon[en]=mate-panel-launcher -Name[en]=chromium -Exec=schroot -c stretch -- chromium --enable-remote-extensions -Comment[en]=chromium -Name=chromium -Comment=chromium -Icon=mate-panel-launcher diff --git a/subdir_files/.local/share/applications/firefox.desktop b/subdir_files/.local/share/applications/firefox.desktop deleted file mode 100644 index 3bd7324..0000000 --- a/subdir_files/.local/share/applications/firefox.desktop +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env xdg-open -# ian: note, this is linked to from ~/.config/menus/mate-applications.menu -[Desktop Entry] -Version=1.0 -Type=Application -Terminal=false -Icon[en]=mate-panel-launcher -Name[en]=firefox -Exec=schroot -c stretch firefox -Comment[en]=firefox -Name=firefox -Comment=firefox -Icon=mate-panel-launcher -- 2.30.2