if [[ -e /var/local/mail-setup-reload ]]; then
reload=true
fi
-# update file.
-# if the file changed, ur=true, else false.
-# note: duplicated in brc
-u() {
- local tmp tmpdir dest="$1"
- local base="${dest##*/}"
- local dir="${dest%/*}"
- if [[ $dir != "$base" ]]; then
- # dest has a directory component
- mkdir -p "$dir"
- fi
- ur=false # u result
- tmpdir=$(mktemp -d)
- cat >$tmpdir/"$base"
- tmp=$(rsync -ic $tmpdir/"$base" "$dest")
- if [[ $tmp ]]; then
- printf "%s\n" "$tmp"
- ur=true
- if [[ $dest == /etc/systemd/system/* ]]; then
- touch /var/local/mail-setup-reload
- reload=true
- fi
- fi
- rm -rf $tmpdir
-}
+
+source /a/bin/fai/fai/config/distro-install-common/bash-misc-funcs
setini() {
key="$1" value="$2" section="$3"
file="/etc/radicale/config"
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
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.