__opendkim: fix start_on_boot on FreeBSD

There was a bit of an oddity with this, it is implemented in a way
that should not be an issue for other systems.

Reviewed at:	#31
This commit is contained in:
evilham 2024-05-16 12:36:40 +02:00
parent 0f281d4118
commit fe523fe993
Signed by: evilham
GPG key ID: AE3EE30D970886BF

View file

@ -29,6 +29,7 @@ case "$os" in
'freebsd')
CFG_DIR="/usr/local/etc/mail"
service="milter-opendkim"
start_service="milteropendkim"
;;
*)
printf "__opendkim does not yet support %s.\n" "$os" >&2
@ -90,7 +91,11 @@ fi
require="__package/opendkim" __file "$target_file" \
--source "$source_file" --mode 0644
require="__package/opendkim" __start_on_boot "${service}"
# Due to the way rc.conf works on *BSD, we find ourselves in the awkward
# situation, where a service's name can contain a '-' symbol, but the
# rc.conf setting to enable a service at boot cannot.
# Unless start_service has been defined before, these two match.
require="__package/opendkim" __start_on_boot "${start_service:-${service}}"
# Ensure Key and Signing tables exist and have proper permissions
key_table="${CFG_DIR}/KeyTable"
@ -105,7 +110,7 @@ require="__package/opendkim" \
--mode 444
require="__file${target_file} __file${key_table}
__file${signing_table} __start_on_boot/${service}" \
__file${signing_table} __start_on_boot/${start_service:-${service}}" \
__check_messages opendkim \
--pattern "^__file${target_file}" \
--execute "service ${service} restart"