install_amavis.sh: some fixes to support debian version 12.

This commit is contained in:
Christoph 2023-10-22 17:54:47 +02:00
parent 4a6d7034f2
commit 2984da58c9

View File

@ -952,7 +952,9 @@ _needed_cpan_modules="CPAN
DBI
DBD::mysql
DBD::Pg"
for _module in $_needed_cpan_modules ; do
if [[ "${os_dist,,}" = "debian" ]] && [[ "$os_version" -lt 12 ]] ; then
for _module in $_needed_cpan_modules ; do
cpanm -q --skip-installed $_module > "$tmp_err_msg" 2>&1
if [[ "$?" -ne 0 ]] ; then
installation_failed=true
@ -971,9 +973,24 @@ for _module in $_needed_cpan_modules ; do
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
done
if ! $installation_failed ; then
done
if ! $installation_failed ; then
echo_ok
fi
else
echo_skipped
info "Needed Perl modules are :
DBI
DBD::mysql
DBD::Pg
All of them are installed via debian package system:
libdbi-perl
libdbd-mysql-perl
libdbd-pg-perl"
fi
## - Temporarily disable crontab for user root
@ -2645,8 +2662,13 @@ EOF
fi
echononl " Restart spamassassin"
if [[ "${os_dist,,}" = "debian" ]] && [[ "$os_version" -lt 12 ]] ; then
_service="spamassassin"
else
_service="spamd"
fi
if $systemd_exists ; then
systemctl restart spamassassin > /dev/null 2> $tmp_err_msg
systemctl restart ${_service} > /dev/null 2> $tmp_err_msg
if [[ $? -eq 0 ]] ; then
echo_ok
else
@ -2663,7 +2685,8 @@ if $systemd_exists ; then
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
/etc/init.d/spamassassin restart > /dev/null 2> $tmp_err_msg
if [[ -f "/etc/init.d/${_service}" ]]; then
/etc/init.d/${_service} restart > /dev/null 2> $tmp_err_msg
if [[ $? -eq 0 ]] ; then
echo_ok
else
@ -2679,6 +2702,9 @@ else
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
echo_skipped
warn "Please restart spamassassin manually.."
fi