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,28 +952,45 @@ _needed_cpan_modules="CPAN
DBI
DBD::mysql
DBD::Pg"
for _module in $_needed_cpan_modules ; do
cpanm -q --skip-installed $_module > "$tmp_err_msg" 2>&1
if [[ "$?" -ne 0 ]] ; then
installation_failed=true
error "$(cat $tmp_err_msg)
command was:
cpanm -q --skip-installed $_module"
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
error "$(cat $tmp_err_msg)
echononl "\tcontinue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
command was:
cpanm -q --skip-installed $_module"
echononl "\tcontinue anyway [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
done
if ! $installation_failed ; then
echo_ok
fi
done
if ! $installation_failed ; then
echo_ok
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,22 +2685,26 @@ if $systemd_exists ; then
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
/etc/init.d/spamassassin restart > /dev/null 2> $tmp_err_msg
if [[ $? -eq 0 ]] ; then
echo_ok
else
echo_failed
error "$(cat $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
echo_failed
error "$(cat $tmp_err_msg)"
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
echononl "continue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/nno]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
echo_skipped
warn "Please restart spamassassin manually.."
fi