use latest node exporter
[distro-setup] / conflink
index d3a7b2a7663c09dbbf6cbee679a75790383c8dc6..e53605e2ae884abf341b7e7edd73ac579ba7d585 100755 (executable)
--- a/conflink
+++ b/conflink
@@ -81,7 +81,10 @@ common-file-setup() {
   for dir in "$@"; do
     fs=$dir/filesystem
     if [[ -e $fs && $user =~ ^iank?$ ]]; then
-      cmd=( s rsync -aiSAX --chown=root:root --chmod=g-s
+      # we dont want t, instead c for checksum.
+      # That way we dont set times on directories.
+      # -a = -rlptgoD
+      cmd=( s rsync -rclpgoDiSAX --chown=root:root --chmod=g-s
             --exclude=/etc/dovecot/users
             --exclude='/etc/exim4/passwd*'
             --exclude='/etc/exim4/*.pem'
@@ -92,7 +95,11 @@ common-file-setup() {
         case $file in
           etc/prometheus/rules/iank.yml)
             case $HOSTNAME in
-              kd) m s systemctl reload prometheus ;;
+              kd)
+                if systemctl is-active prometheus &>/dev/null; then
+                  m s systemctl reload prometheus
+                fi
+                ;;
             esac
             ;;
           etc/systemd/system/*)
@@ -115,7 +122,7 @@ common-file-setup() {
       done < <("${cmd[@]}")
     fi
 
-    if [[ -e $dir/subdir_files ]]; then
+    if ! $fast && [[ -e $dir/subdir_files ]]; then
       m subdir-link-r $dir/subdir_files
     fi
     local x=( $dir/!(binds|subdir_files|filesystem|machine_specific|..|.|.#*) )
@@ -140,20 +147,26 @@ for x in /p/c/machine_specific/*.hosts /a/bin/ds/machine_specific/*.hosts; do
   if grep -qxF $HOSTNAME $x; then all_dirs+=( ${x%.hosts} ); fi
 done
 
-# old files 2022-03
-for t in systemstatus epanicclean btrfsmaintstop dynamicipupdate; do
-  f=/etc/systemd/system/$t.timer
-  if [[ -e $f ]]; then
-    s systemctl stop $t.timer
-    s systemctl disable $t.timer
-    s rm -fv $f
-    reload_systemd=true
-  fi
-done
 
 c_dirs=(/a/c{,/machine_specific/$HOSTNAME})
 case $user in
   iank)
+    # old files 2022-03
+    for t in systemstatus epanicclean btrfsmaintstop dynamicipupdate; do
+      f=/etc/systemd/system/$t.timer
+      if [[ -e $f ]]; then
+        s systemctl stop $t.timer
+        s systemctl disable $t.timer
+        s rm -fv $f
+        reload_systemd=true
+      fi
+    done
+    # old 2022-04
+    if [[ -e /etc/cron.daily/check-lets-encrypt-ssl-settings ]]; then
+      m s rm -f /etc/cron.daily/check-lets-encrypt-ssl-settings
+    fi
+
+
     /a/bin/ds/install-my-scripts
     files=(/p/c/machine_specific/*/filesystem/etc/ssh/*_key
            /p/c/machine_specific/*/filesystem/etc/openvpn/client/*.key
@@ -185,7 +198,7 @@ case $user in
     for f in /etc/prometheus-{,export-}htpasswd; do
       if [[ -e $f ]]; then
         s chmod 640 $f
-        if getent passwd www-data; then
+        if getent passwd www-data &>/dev/null; then
           s chown root:www-data $f
         fi
       fi
@@ -194,15 +207,15 @@ case $user in
     if [[ -e $f ]]; then
       # note: this is duplicative of the file's own permissions
       s chmod 640 $f /etc/prometheus-pass
-      if getent passwd prometheus; then
+      if getent passwd prometheus &>/dev/null; then
         s chown root:prometheus $f
       fi
     fi
-
-
     ##### end special extra stuff #####
 
-    m sudo -H -u user2 "${BASH_SOURCE[0]}"
+    if ! $fast; then
+      m sudo -H -u user2 "${BASH_SOURCE[0]}"
+    fi
 
     f=/a/bin/distro-setup/system-status
     if [[ -x $f ]]; then