install_amavis.sh: Adjust Configuring 'ClamAV Unofficial Signatures'.

This commit is contained in:
Christoph 2020-08-08 17:14:30 +02:00
parent cbce2e67c9
commit bdaf20d304

View File

@ -1014,7 +1014,6 @@ _needed_packages_spamassassin="
libmail-spf-perl \
libgeo-ipfree-perl \
libnet-ident-perl \
libio-zlib-perl \
libio-string-perl \
libimage-info-perl \
libnet-cidr-lite-perl \
@ -1026,6 +1025,12 @@ _needed_packages_spamassassin="
ftp \
ncftp \
less"
if [[ "$os_version" -lt 10 ]] ; then
_needed_packages_spamassassin="$_needed_packages_spamassassin \
libio-zlib-perl"
fi
for _pkg in $_needed_packages_spamassassin ; do
if aptitude search $_pkg | grep " $_pkg " | grep -e "^i" > /dev/null 2>&1 ; then
continue
@ -3064,23 +3069,49 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
fi
echononl " Copy readme file 'INSTALL' into '/etc/clamav-unofficial-sigs/'.."
cp -a /tmp/clamav-unofficial-sigs/INSTALL /etc/clamav-unofficial-sigs/INSTALL > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
else
echo_failed
error "$(cat $tmp_err_msg)"
if [[ -f "/tmp/clamav-unofficial-sigs/INSTALL" ]]; then
cp -a /tmp/clamav-unofficial-sigs/INSTALL /etc/clamav-unofficial-sigs/INSTALL > $tmp_err_msg 2>&1
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"
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
elif [[ -f "/tmp/clamav-unofficial-sigs/INSTALL.md" ]]; then
cp -a /tmp/clamav-unofficial-sigs/INSTALL.md /etc/clamav-unofficial-sigs/INSTALL.md > $tmp_err_msg 2>&1
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
else
echo_skipped
fi
if [[ "${os_dist,,}" = "debian" ]] ; then
if [[ "$os_version" = "8" ]] || [[ "$os_version" = "9" ]] || [[ "$os_version" = "10" ]] ; then
@ -3099,7 +3130,15 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
_failed=true
fi
else
failed=true
if [[ -f "/etc/clamav-unofficial-sigs/os/os.debian.conf" ]] ; then
cp "/etc/clamav-unofficial-sigs/os/os.debian.conf" \
"/etc/clamav-unofficial-sigs/os.conf" > $tmp_err_msg 2>&1
if [[ $? -ne 0 ]]; then
_failed=true
fi
else
_failed=true
fi
fi
else
cp "/etc/clamav-unofficial-sigs/os.debian${os_version}.conf" \
@ -3154,8 +3193,14 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
installation_failed=true
error "$(cat $tmp_err_msg)"
fi
perl -i -n -p -e "s#^([ ]*\ *)(clamd_pid=.*)#\#\#\1\2\nclamd_pid=\"/var/run/clamav/clamd.pid\"#" \
/etc/clamav-unofficial-sigs/os.conf > $tmp_err_msg 2>&1
if [[ "${os_dist,,}" = "debian" ]] && [[ "$os_version" -ge 10 ]]; then
perl -i -n -p -e "s#^([ ]*\ *)(clamd_pid=.*)#\#\#\1\2\nclamd_pid=\"/run/clamav/clamd.pid\"#" \
/etc/clamav-unofficial-sigs/os.conf > $tmp_err_msg 2>&1
else
perl -i -n -p -e "s#^([ ]*\ *)(clamd_pid=.*)#\#\#\1\2\nclamd_pid=\"/var/run/clamav/clamd.pid\"#" \
/etc/clamav-unofficial-sigs/os.conf > $tmp_err_msg 2>&1
fi
if [[ "$?" -ne 0 ]] ; then
installation_failed=true
error "$(cat $tmp_err_msg)"
@ -3176,8 +3221,13 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
error "$(cat $tmp_err_msg)"
fi
fi
perl -i -n -p -e "s#^([ ]*\#?\ *)(clamd_socket=.*)#\#\#\1\2\nclamd_socket=\"/var/run/clamav/clamd.ctl\"#" \
/etc/clamav-unofficial-sigs/os.conf > $tmp_err_msg 2>&1
if [[ "${os_dist,,}" = "debian" ]] && [[ "$os_version" -ge 10 ]]; then
perl -i -n -p -e "s#^([ ]*\#?\ *)(clamd_socket=.*)#\#\#\1\2\nclamd_socket=\"/run/clamav/clamd.ctl\"#" \
/etc/clamav-unofficial-sigs/os.conf > $tmp_err_msg 2>&1
else
perl -i -n -p -e "s#^([ ]*\#?\ *)(clamd_socket=.*)#\#\#\1\2\nclamd_socket=\"/var/run/clamav/clamd.ctl\"#" \
/etc/clamav-unofficial-sigs/os.conf > $tmp_err_msg 2>&1
fi
if [[ "$?" -ne 0 ]] ; then
installation_failed=true
error "$(cat $tmp_err_msg)"
@ -3310,8 +3360,8 @@ EOF
fi
echononl " Copy Systemd Configurations to /etc/systemd"
cp /tmp/clamav-unofficial-sigs/systemd/* /etc/systemd/ > $tmp_err_msg 2>&1
echononl " Copy Systemd Configurations to /etc/systemd/system"
cp /tmp/clamav-unofficial-sigs/systemd/* /etc/systemd/system/ > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
else
@ -3328,9 +3378,9 @@ EOF
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
echononl " Adjust /etc/systemd/clamav-unofficial-sigs.service"
echononl " Adjust /etc/systemd/system/clamav-unofficial-sigs.service"
perl -i -n -p -e "s#^([ ]*\ *)(ExecStart=.*)#\#\#\1\2\nExecStart=/usr/local/sbin/clamav-unofficial-sigs.sh#" \
/etc/systemd/clamav-unofficial-sigs.service > $tmp_err_msg 2>&1
/etc/systemd/system/clamav-unofficial-sigs.service > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
else