mainly changes to keep systems up to date
authorIan Kelling <ian@iankelling.org>
Wed, 16 Oct 2019 20:34:57 +0000 (16:34 -0400)
committerIan Kelling <ian@iankelling.org>
Wed, 16 Oct 2019 20:34:57 +0000 (16:34 -0400)
Makefile [new file with mode: 0644]
brc2
conflink
distro-begin
distro-end
keyscript-off
keyscript-on
subdir_files/sieve/lists.sieve
subdir_files/sieve/liststest.sieve
system-status

diff --git a/Makefile b/Makefile
new file mode 100644 (file)
index 0000000..b2d2dc8
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,7 @@
+all: ~/.local/distro-begin ~/.local/distro-end
+
+~/.local/distro-begin: distro-begin
+       distro-begin
+
+~/.local/distro-end: distro-end distro-pkgs pkgs
+       distro-end
diff --git a/brc2 b/brc2
index fd7fcafb6670fec4f7516d6356ca4e30ffad7774..20780faa046aa30d3d11bf50ac1eaa33796f0e93 100644 (file)
--- a/brc2
+++ b/brc2
@@ -920,11 +920,16 @@ testexim() {
   # note, for exim daemon, you can turn on debug options by
   # adding -d, etc to COMMONOPTIONS in
   # /etc/default/exim4
-  #  exim -d -t <<'EOF'
-  exim -i 'test@zroe.org, t2@zroe.org'  <<'EOF'
-From: ian@iankelling.org
-To: test@zroe.org, t2@zroe.org
-Subject: Testing Exim
+  #
+  # to specify recipients other than those in to, cc, bcc, you can use the cli args, eg:
+  #  exim -i 'test@zroe.org, t2@zroe.org'  <<'EOF'
+  #
+  #
+  exim -d -t <<'EOF'
+From: i@dmarctest.b8.nz
+To: mailman@dev.fsf.org
+Subject: test2
+Reply-to: rtest@iankelling.org
 
 This is a test message.
 EOF
index 0dffc229e80b1b662c75fc8a0a6098008efebb88..30d868e4dae606d244bc2decb19126fda8d70799 100755 (executable)
--- a/conflink
+++ b/conflink
@@ -1,6 +1,9 @@
 #!/bin/bash
 
 source /a/bin/errhandle/err
+_errcatch_cleanup() {
+  echo 1 >~/.local/conflink
+}
 
 
 usage() {
@@ -141,3 +144,5 @@ case $user in
     echo "$0: error: unexpected user"; exit 1
     ;;
 esac
+
+echo 0 >~/.local/conflink
index b2b21f783f68c67b380e38f17704c2b91e6f2b41..abcb892f5e1f4747e64cd6a7adb474af8ba21555 100755 (executable)
@@ -36,6 +36,11 @@ if ! $interactive; then
   set -x
 fi
 source /a/bin/errhandle/err
+
+_errcatch_cleanup() {
+  echo 1 >~/.local/distro-begin
+}
+
 source /a/bin/distro-functions/src/package-manager-abstractions
 
 ### setup logging
@@ -106,6 +111,8 @@ if encrypted; then
   sudo dd of=/etc/systemd/system/keyscripton.service <<'EOF'
 [Unit]
 Description=Turn on automatic decryption of drives on boot
+# This is triggered by reboot and when keyscriptoff stops.
+
 # tried using graphical.target, but it made my display manager restart before rebooting.
 # generally, I don't think targets order shutdown like they do startup.
 # So, I did systemd-analyze plot > something.svg, and picked a reliably started
@@ -125,8 +132,6 @@ ExecStop=/a/exe/keyscript-on
 WantedBy=keyscriptoff.service
 EOF
   sudo systemctl daemon-reload # needed if the file was already there
-  sudo systemctl stop keyscripton.service
-  #    sudo systemctl start keyscripton.service
   sudo systemctl enable keyscripton.service
 
   sudo dd of=/etc/systemd/system/keyscriptoff.service <<'EOF'
@@ -153,7 +158,7 @@ EOF
     | sudo dd of=$tmp
   if ! diff -q /etc/initramfs-tools/modules $tmp &>/dev/null; then
     sudo dd if=$tmp of=/etc/initramfs-tools/modules
-    sudo /usr/sbin update-initramfs -u -k all
+    sudo /usr/sbin/update-initramfs -u -k all
   fi
   # initram auth keys get setup with rootsshsync
   $script_dir/rootsshsync
@@ -202,7 +207,7 @@ fi
 
 
 #### setup bash for root
-for x in /a/c/{.bashrc,brc,.bash_profile,.profile,.inputrc,path_add_function}; do
+for x in /a/c/{.bashrc,brc,brc2,.bash_profile,.profile,.inputrc,path_add_function}; do
   sudo -i <<EOF
 PATH="/a/exe:$PATH"
 lnf $x /root
@@ -582,5 +587,7 @@ if $emacs; then
   /a/exe/ssh-emacs-setup
 fi
 
+
+echo 0 >~/.local/distro-begin
 echo "$0: $(date): ending now"
 exit 0
index 52199b8216d2167f6ee6acd6aa9aa4ff93dadfa1..f66090b0e8976f9c413be6d34094999374353b71 100755 (executable)
@@ -1,22 +1,20 @@
 #!/bin/bash -l
-# Copyright (C) 2016 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.
+# Copyright (C) 2019 Ian Kelling
+# SPDX-License-Identifier: AGPL-3.0-or-later
 
 ### setup
 source /a/bin/errhandle/err
 src="$(readlink -f -- "${BASH_SOURCE[0]}")"; src=${src%/*} # directory of this file
 
+if [[ $EUID == 0 ]]; then
+  echo "$0: error: run as regular user" >&2
+  exit 1
+fi
+
+_errcatch_cleanup() {
+  echo 1 >~/.local/distro-end
+}
+
 # shellcheck source=./pkgs
 source $src/pkgs
 
@@ -1682,7 +1680,7 @@ e "$end_msg_var"
 
 ######### begin stuff belonging at the end    ##########
 
-
+echo 0 >~/.local/distro-end
 if $pending_reboot; then
   echo "$0: pending reboot and then finished. doing it now."
   s reboot now
index 1cf19b0d24e6c782216986421264c238ad1f1826..2984a2a7b0108acbb3d43757eb18e55015c8a365 100755 (executable)
@@ -1,17 +1,6 @@
 #!/bin/bash
-# Copyright (C) 2016 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.
+# Copyright (C) 2019 Ian Kelling
+# SPDX-License-Identifier: AGPL-3.0-or-later
 
 set -eE -o pipefail
 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
index 246a971123363fbbc3d6c8a9e5dc7140c691299f..6307b3636153c1a7a2c2d77f811b81ac6229d7ae 100755 (executable)
@@ -1,17 +1,6 @@
 #!/bin/bash
-# Copyright (C) 2016 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.
+# Copyright (C) 2019 Ian Kelling
+# SPDX-License-Identifier: AGPL-3.0-or-later
 
 set -eE -o pipefail
 trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?"' ERR
index ca6984cd9070ea174134b854c5ed0a63be17804c..4fa00162a1d8e9a61f325a97746bc97e23b235f8 100644 (file)
@@ -96,6 +96,7 @@ if anyof (
     header :contains "list-id" "<gnu-prog.gnu.org>",
     header :contains "list-id" "<www-discuss.gnu.org>",
     header :contains "list-id" "<gnu-community-private.gnu.org>",
+    header :contains "list-id" "<gnu-system-discuss.gnu.org>",
     header :contains "list-id" "<gvc.gnu.org>",
     header :contains "list-id" "<discuss.blu.org>",
     header :contains "list-id" "<Spdx-tech.lists.spdx.org>",
index ca6984cd9070ea174134b854c5ed0a63be17804c..4fa00162a1d8e9a61f325a97746bc97e23b235f8 100644 (file)
@@ -96,6 +96,7 @@ if anyof (
     header :contains "list-id" "<gnu-prog.gnu.org>",
     header :contains "list-id" "<www-discuss.gnu.org>",
     header :contains "list-id" "<gnu-community-private.gnu.org>",
+    header :contains "list-id" "<gnu-system-discuss.gnu.org>",
     header :contains "list-id" "<gvc.gnu.org>",
     header :contains "list-id" "<discuss.blu.org>",
     header :contains "list-id" "<Spdx-tech.lists.spdx.org>",
index c6f3fe7f5144d3c3661196289cc8cfbb062059ed..25a637ee9606788c97e22949b470a811428abf16 100755 (executable)
@@ -35,6 +35,39 @@ write-status() {
     chars+=("MAILPING!")
   fi
 
+
+  if ! make -q ~/.local/distro-begin || [[ $(<~/.local/distro-begin) != 0 ]]; then
+    chars+=("DISTRO-BEGIN!")
+  fi
+
+  if ! make -q ~/.local/distro-end || [[ $(<~/.local/distro-end) != 0 ]]; then
+    chars+=("DISTRO-END!")
+  fi
+
+  f=~/.local/conflink
+  if [[ -e $f ]]; then
+    cd /b/ds
+    now=$(date +%s)
+    fsec=$(stat -c%Y $f)
+    fmin=$(( (fsec - now ) / 60 + 1 ))
+    fminplus=$(( fmin + 60*24 ))
+    # Filesystem files get copied, so find any newer than the last run.
+    # The rest are hueristics:
+    # Given the last time we added a file in git, is that newer than the last conflink run.
+    # Given new files not added to git, were they modified more recently than the last conflink? but,
+    # push their modification time back by a day so we can develop them before needing to add them to git.
+    if (( $(date -d "$(git log --diff-filter=ACR --format=%aD -1)" +%s) > fsec )) || \
+         [[ $(find {/a/bin/ds,/p/c}{/filesystem,/machine_specific/$HOSTNAME/filesystem} -mmin $fmin -type f -print -quit 2>/dev/null) ]] \
+         || [[ $(find $(git ls-files -o --exclude-standard) -mmin $fminplus -type f -print -quit) ]]; then
+      chars+=("CONFLINK!")
+    fi
+  fi
+
+  if [[ ! -e $f || $(<$f) != 0 ]]; then
+    chars+=("CONFLINK!")
+  fi
+
+
   ## Clean the paniclog, but only up to 4 times per day, or else we
   ## should investigate.
   loglog=/tmp/panicloglog-$(date --rfc-3339=date)