From 5e45ae077e790c0e798f09ffad8ecd3cb6c3bb28 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Thu, 13 Jan 2022 19:39:33 -0500 Subject: [PATCH] fixes --- distro-end | 5 ++- .../etc/systemd/system/systemstatus.service | 1 + mail-setup | 41 +++++++++++-------- switch-mail-host | 6 ++- system-status | 2 +- 5 files changed, 33 insertions(+), 22 deletions(-) diff --git a/distro-end b/distro-end index 51d0144..0746d82 100755 --- a/distro-end +++ b/distro-end @@ -873,7 +873,10 @@ case $distro in deb http://ppa.launchpad.net/obsproject/obs-studio/ubuntu $codename_compat main deb-src http://ppa.launchpad.net/obsproject/obs-studio/ubuntu $codename_compat main EOF - s apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BC7345F522079769F5BBE987EFC71127F425E228 + for (( i=0; i <= 4 ; i++ )); do + s apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BC7345F522079769F5BBE987EFC71127F425E228 && break + sleep 10 + done p update fi ;; diff --git a/filesystem/etc/systemd/system/systemstatus.service b/filesystem/etc/systemd/system/systemstatus.service index 23afb89..725df34 100644 --- a/filesystem/etc/systemd/system/systemstatus.service +++ b/filesystem/etc/systemd/system/systemstatus.service @@ -4,6 +4,7 @@ After=multi-user.target [Service] Type=oneshot +Environment=XDG_RUNTIME_DIR=/run/user/1000 ExecStart=/usr/local/bin/sysd-mail-once -3 systemstatus /usr/local/bin/system-status IOSchedulingClass=idle CPUSchedulingPolicy=idle diff --git a/mail-setup b/mail-setup index f8cb3ee..f7f1fc5 100755 --- a/mail-setup +++ b/mail-setup @@ -418,21 +418,6 @@ fi # our nostart pi fails to avoid enabling -# * user forward file -case $HOSTNAME in - $MAIL_HOST) - # afaik, these will get ignored on MAIL_HOST because they are routing to my own - # machine, but rm them is safer - rm -fv $uhome/.forward /root/.forward - ;; - *) - # this can\'t be a symlink and has permission restrictions - # it might work in /etc/aliases, but this seems more proper. - e setting $uhome/.forward to $forward - install -m 644 {-o,-g}$u <(e $forward) $uhome/.forward - ;; -esac - # * Mail clean cronjob i /etc/systemd/system/mailclean.timer <<'EOF' @@ -841,9 +826,13 @@ fi # * common exim4 config +## old, not using forward files anymore +rm -fv $uhome/.forward /root/.forward + + # Make all system users be aliases. preventative -# measure for things like cron mail for user without alias -awk 'BEGIN { FS = ":" } ; $6 !~ /^\/home/ { print $1 }' /etc/passwd| while read -r user; do +# prevents things like cron mail for user without alias +awk 'BEGIN { FS = ":" } ; $6 !~ /^\/home/ || $7 ~ /\/nologin$/ { print $1 }' /etc/passwd| while read -r user; do if [[ ! $user ]]; then continue fi @@ -852,6 +841,20 @@ awk 'BEGIN { FS = ":" } ; $6 !~ /^\/home/ { print $1 }' /etc/passwd| while read fi done + +awk 'BEGIN { FS = ":" } ; $6 ~ /^\/home/ && $7 !~ /\/nologin$/ { print $1 }' /etc/passwd| while read -r user; do + case $HOSTNAME in + $MAIL_HOST) + sed -i "/^user:/d" /etc/aliases + ;; + *) + if ! grep -q "^$user:" /etc/aliases; then + echo "$user: root" |m tee -a /etc/aliases + fi + ;; + esac +done + if ! grep -q "^ncsoft:" /etc/aliases; then echo "ncsoft: graceq2323@gmail.com" |m tee -a /etc/aliases fi @@ -2508,10 +2511,12 @@ EOF # The debconf questions output is additional documentation that is not # easily accessible, but super long, along with the initial default comment in this # file, so I've saved that into ./mail-notes.conf. + # + # # TODO: remove mx.iankelling.org once systems get updated mail-setup from jan 2022 cat >>/etc/exim4/update-exim4.conf.conf </dev/null; then +if pgrep -G iank -u iank -f 'emacs --daemon' &>/dev/null; then + export XDG_RUNTIME_DIR=/run/user/1000 bufs="$(emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//')" if [[ $bufs ]]; then echo "error: on $HOSTNAME, unsaved emacs files: $bufs" >&2 @@ -169,7 +170,8 @@ done EOF $old_shell bash -s <<'EOF' -if pgrep -f 'emacs --daemon' &>/dev/null; then +if pgrep -G iank -u iank -f 'emacs --daemon' &>/dev/null; then + export XDG_RUNTIME_DIR=/run/user/1000 bufs="$(emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//')" if [[ $bufs ]]; then echo "error: on $HOSTNAME, unsaved emacs files: $bufs" >&2 diff --git a/system-status b/system-status index 2dd39ca..c3fe13b 100644 --- a/system-status +++ b/system-status @@ -53,7 +53,7 @@ write-status() { fi fi - if pgrep -f 'emacs --daemon' &>/dev/null; then + if pgrep -G iank -u iank -f 'emacs --daemon' &>/dev/null; then emacsfiles="$(emacsclient --eval "$(cat /a/bin/ds/unsaved-buffers.el)"| sed '/^"nil"$/d;s/^"(/E: /;s/)"$//')" if [[ $emacsfiles ]]; then chars+=("$emacsfiles") -- 2.30.2