distro specific fixes
[distro-setup] / mail-setup
index cdbf9e8ef4216f71453e4d131ee9c40706b7ec20..616d39bae20e9b2fdfe033754a39fb2e4fd297d8 100755 (executable)
@@ -453,9 +453,17 @@ Pin-Priority: 500
 EOF
 fi
 
+
+unit-exists() {
+  systemctl cat $1 &>/dev/null
+}
+spamd-timer-exists() {
+  unit-exists spamassassin-maintenance.timer
+}
+
 # name change in t12, and now timer instead of cron option in /etc/default
 first_spamd_run=false
-if ! systemctl cat spamassassin-maintenance.timer &>/dev/null; then
+if ! spamd-timer-exists; then
   first_spamd_run=true
 fi
 
@@ -468,10 +476,14 @@ spamd_ser=spamd
 if systemctl cat spamassassin &>/dev/null; then
   spamd_ser=spamassassin
 elif $first_spamd_run; then
-  systemctl start spamassassin-maintenance
+  if spamd-timer-exists; then
+    systemctl start spamassassin-maintenance
+  fi
 fi
 
-systemctl enable --now spamassassin-maintenance.timer
+if spamd-timer-exists; then
+  systemctl enable --now spamassassin-maintenance.timer
+fi
 
 # note: pyzor debian readme says you need to run some initialization command
 # but its outdated.