From e300369ab07750d2e455e01585a7b9b0f45b5e9e Mon Sep 17 00:00:00 2001
From: Matthew Saunders Brown <msb@stackaas.com>
Date: Tue, 19 Jul 2022 13:27:19 -0700
Subject: [PATCH] add sbin to install and update

---
 install.sh |  2 ++
 update.sh  | 17 +++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/install.sh b/install.sh
index 950cdee..3e54497 100755
--- a/install.sh
+++ b/install.sh
@@ -217,4 +217,6 @@ cp mini_sendmail.8.gz /usr/local/share/man/man8
 # install vhost scripts
 chmod 755 bin/*
 cp bin/* /usr/local/bin/
+chmod 755 sbin/*
+cp sbin/* /usr/local/sbin/
 
diff --git a/update.sh b/update.sh
index 07c5562..50d8549 100755
--- a/update.sh
+++ b/update.sh
@@ -25,6 +25,23 @@ for bin_script in "${bin_script_array[@]}"; do
   fi
 done
 
+# update scripts in bin
+chmod 755 sbin/*
+readarray -t sbin_script_array < <(ls -1 sbin/)
+for sbin_script in "${sbin_script_array[@]}"; do
+  if [ -f /usr/local/sbin/$sbin_script ]; then
+    if ! diff -q sbin/$sbin_script /usr/local/sbin/$sbin_script ; then
+      echo "Updating /usr/local/sbin/$sbin_script"
+      cp sbin/$sbin_script /usr/local/sbin/$sbin_script
+      echo
+    fi
+  else
+    echo "Adding new script /usr/local/sbin/$sbin_script"
+    cp sbin/$sbin_script /usr/local/sbin/$sbin_script
+    echo
+  fi
+done
+
 # check etc configs for diffs
 readarray -t etc_configs_array < <(find etc/ -type f)
 for etc_config in "${etc_configs_array[@]}"; do