From a699f504bbb1848d330930f74876284258bebd0f Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Tue, 28 Jan 2020 18:26:50 -0500 Subject: [PATCH] various fixes --- brc2 | 4 +++- check-subvol-stale | 4 ++-- distro-end | 2 +- filesystem/etc/cron.d/ian | 2 +- mail-setup | 18 +++++++++++++++--- mount-latest-subvol | 3 ++- schrootupdate | 2 +- 7 files changed, 25 insertions(+), 10 deletions(-) diff --git a/brc2 b/brc2 index 93a141e..d8a0358 100644 --- a/brc2 +++ b/brc2 @@ -833,7 +833,9 @@ rcat() { } reresolv() { sudo nscd -i hosts - #sudo systemctl restart dnsmasq + if [[ $(systemctl is-active dnsmasq ||:) != inactive ]]; then + sudo systemctl restart dnsmasq + fi } # only run on MAIL_HOST. simpler to keep this on one system. diff --git a/check-subvol-stale b/check-subvol-stale index 8e7d754..4f489e7 100644 --- a/check-subvol-stale +++ b/check-subvol-stale @@ -17,7 +17,7 @@ [[ $EUID == 0 ]] || exec sudo -E "${BASH_SOURCE[0]}" "$@" set -eE -o pipefail -trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR +trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?. PIPESTATUS: ${PIPESTATUS[@]}" >&2' ERR shopt -s nullglob @@ -137,7 +137,7 @@ for d; do unix_time=$(date -d $(sed -r 's/(.{4})(..)(.{5})(..)(.*)/\1-\2-\3:\4:\5/' <<<${f#$vol.}) +%s) printf "%s %s\n" $unix_time $s # sort will fail - done | sort -r | head -n 1 | awk '{print $2}' || [[ ${PIPESTATUS[1]} == 2 ]] + done | sort -r | head -n 1 | awk '{print $2}' || [[ ${PIPESTATUS[1]} == 141 ]] ) if [[ ! $last_snap ]]; then # should not happen. diff --git a/distro-end b/distro-end index 875aab5..b62e1ff 100755 --- a/distro-end +++ b/distro-end @@ -642,7 +642,7 @@ case $codename_compat in m systemctl --user disable gvfs-daemon # apt-get update periodically fails with an appstream error. # this removes gnome-core, but its just a package for dependencies - p remove appstream + p -y remove appstream ;; esac diff --git a/filesystem/etc/cron.d/ian b/filesystem/etc/cron.d/ian index 76dfa4e..5545e13 100644 --- a/filesystem/etc/cron.d/ian +++ b/filesystem/etc/cron.d/ian @@ -5,4 +5,4 @@ PATH=/usr/bin:/bin:/usr/local/bin:/a/exe * * * * * iank system-status |& log-once system-status # If theres any logged errors we didnt handle in 4 days, maybe we accidentally missed them, # so report if we did -4 9 * * 5 root find /var/local/cron-errors /home/iank/cron-errors -type f -mtime +4 +4 9 * * 5 root find /var/local/cron-errors /home/iank/cron-errors /sysd-mail-once-state -type f -mtime +4 diff --git a/mail-setup b/mail-setup index 443bc74..575511d 100755 --- a/mail-setup +++ b/mail-setup @@ -479,6 +479,17 @@ deny !authenticated = * domains = mail.iankelling.org EOF + +# This acl already exists in rcpt, this just makes it more widespread. +# See the comment there for its rationale. The reason it needs to be +# more widespread is that I've turned on sender verification, but cron +# emails can fail sender verification since I may be in a network that +# doesn't have my local dns. +cat >/etc/exim4/conf.d/local_deny_exceptions_acl <<'EOF' +accept + authenticated = * +EOF + rm -fv /etc/exim4/data_local_acl # old path cat >/etc/exim4/conf.d/data_local_acl <<'EOF' # Except for the "condition =", this was @@ -708,7 +719,7 @@ EOF cat >>/etc/exim4/conf.d/main/000_local <>/etc/cron.d/mailtest <&2' ERR for n in stretch; do if [[ -e /etc/schroot/chroot.d/$n.conf ]]; then - cd + cd / schroot -c $n -- apt-get -y dist-upgrade --purge --auto-remove fi done -- 2.30.2