install_amavis.sh: some changes installing 'clamav-unofficial-sigs'.

This commit is contained in:
Christoph 2021-12-22 00:52:13 +01:00
parent 112cde3f7d
commit 39859dcb51

View File

@ -3071,6 +3071,41 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
echononl " Check if working directory for 'urlhaus' will be created if not exists.."
_clamav_script="/usr/local/sbin/clamav-unofficial-sigs.sh"
if ! $(grep -q -E "^\s*xshok_mkdir_ownership\s+\"\\\$work_dir_urlhaus\"" "${_clamav_script}" 2> /dev/null) ; then
if $(grep -q -E "^\s*xshok_mkdir_ownership\s+\"\\\$work_dir\"" "${_clamav_script}" 2> /dev/null) ; then
perl -i -n -p \
-e "s#(\s*xshok_mkdir_ownership\s+)(\"\\\$work_dir\")#\1\2\n\1\"\\\$work_dir_urlhaus\"#" \
"${_clamav_script}" > $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
else
echo_skipped
fi
_create_dirs="/var/log/clamav-unofficial-sigs /etc/clamav-unofficial-sigs"
for _create_dir in $_create_dirs ; do
echononl " Create directory \"${_create_dir}\""
@ -3160,19 +3195,18 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
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)
## - For Debian Jessie (Debian 8) // Stretch (Debian 9) // Buster (Debian 10) // Bullseye (Debian 11)
## -
_failed=false
echononl " At directory /etc/clamav-unofficial-sigs copy os.debian${os_version}.conf to os.conf"
if [[ ! -f /etc/clamav-unofficial-sigs/os.debian${os_version}.conf ]] ; then
if [[ ! -f /etc/clamav-unofficial-sigs/os/os.debian${os_version}.conf ]] ; then
_tmp_version=$(expr $os_version - 1)
if [[ -f "/etc/clamav-unofficial-sigs/os.debian${_tmp_version}.conf" ]] ; then
cp "/etc/clamav-unofficial-sigs/os.debian${_tmp_version}.conf" \
if [[ -f "/etc/clamav-unofficial-sigs/os/os.debian${_tmp_version}.systemd.conf" ]] ; then
cp "/etc/clamav-unofficial-sigs/os/os.debian${_tmp_version}.systemd.conf" \
"/etc/clamav-unofficial-sigs/os.conf" > $tmp_err_msg 2>&1
if [[ $? -ne 0 ]]; then
echo "File not found: /etc/clamav-unofficial-sigs/os.debian${os_version}.conf" > $tmp_err_msg
echo "Error copying /etc/clamav-unofficial-sigs/os.debian${os_version}.systemd.conf" >> $tmp_err_msg
_failed=true
fi
else
@ -3187,7 +3221,7 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
fi
fi
else
cp "/etc/clamav-unofficial-sigs/os.debian${os_version}.conf" \
cp "/etc/clamav-unofficial-sigs/os/os.debian${os_version}.conf" \
"/etc/clamav-unofficial-sigs/os.conf" > $tmp_err_msg 2>&1
if [[ $? -ne 0 ]]; then
_failed=true
@ -3290,9 +3324,11 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
if ! $installation_failed ; then
echo_ok
fi
else
error "Cannot create file '/etc/clamav-unofficial-sigs/os.conf' (No Debian Version detected).
See file /etc/clamav-unofficial-sigs/INSTALL.md to create it manually"
error "Cannot create file 'os.conf' (No Linux Distribution detected)
See file /etc/clamav-unofficial-sigs/INSTALL to create it manually"
echononl "continue anyway [yes/no]: "
read OK
@ -3304,10 +3340,6 @@ if $INSTALL_CLAMAV_UNOFFICIAL_SIGS ; then
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
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"