install_amavis.sh: Fix error at installing ClamAV Unofficial Signatures.

This commit is contained in:
Christoph 2018-04-27 04:11:49 +02:00
parent 3e17213c95
commit 683b6927b0

View File

@ -60,6 +60,35 @@ echo_skipped() {
echo -e "\033[80G[ \033[33m\033[1mskipped\033[m ]"
}
detect_os_1 () {
if $(which lsb_release > /dev/null 2>&1) ; then
os_dist="$(lsb_release -i | awk '{print tolower($3)}')"
os_version="$(lsb_release -r | awk '{print tolower($2)}')"
os_codename="$(lsb_release -c | awk '{print tolower($2)}')"
if [[ "$os_dist" = "debian" ]]; then
if $(echo "$os_version" | grep -q '\.') ; then
os_version=$(echo "$os_version" | cut --delimiter='.' -f1)
fi
fi
elif [[ -e "/etc/os-release" ]]; then
. /etc/os-release
os_dist=$ID
os_version=${VERSION_ID}
fi
# remove whitespace from os_dist and os_version
os_dist="${os_dist// /}"
os_version="${os_version// /}"
}
# - Is this a systemd system?
# -
@ -69,6 +98,13 @@ else
systemd_exists=true
fi
# - Set variable
# - os_dist
# - os_version
# - os_codename
# -
detect_os_1
echo ""
@ -2752,10 +2788,22 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
error "$(cat $tmp_err_msg)"
fi
## - For Debian Jessie (Debian 8)
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)"
fi
if [[ "${os_dist,,}" = "debian" ]] ; then
if [[ "$os_version" = "8" ]] || [[ "$os_version" = "9" ]] || [[ "$os_version" = "10" ]] ; then
## - For Debian Jessie (Debian 8) // Stretch (Debian 9) // Buster (Debian 10)
## -
echononl " At directory /etc/clamav-unofficial-sigs copy os.debian8.conf to os.conf"
cp /etc/clamav-unofficial-sigs/os.debian8.conf /etc/clamav-unofficial-sigs/os.conf > $tmp_err_msg 2>&1
echononl " At directory /etc/clamav-unofficial-sigs copy os.debian${os_version}.conf to os.conf"
cp /etc/clamav-unofficial-sigs/os.debian${os_version}.conf /etc/clamav-unofficial-sigs/os.conf > $tmp_err_msg 2>&1
if [[ $? -eq 0 ]] ; then
echo_ok
else
@ -2824,6 +2872,16 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
if ! $installation_failed ; then
echo_ok
fi
else
error "Cannot create file 'os.conf' (No Debian Version detected).
See file /etc/clamav-unofficial-sigs/INSTALL to create it manually"
fi
else
error "Cannot create file 'os.conf' (No Linux Distribution detected)
See file /etc/clamav-unofficial-sigs/INSTALL to create it manually"
fi # if [[ "${os_dist,,}" = "debian" ]]
echononl " Adjust /etc/clamav-unofficial-sigs/user.conf"