install_update_dovecot-2.4.sh: adjust sieve configuration.

This commit is contained in:
2025-12-09 17:49:41 +01:00
parent ecfd630612
commit b28b3a8316

View File

@@ -7587,9 +7587,10 @@ if [[ $dovecot_major_version -gt 2 ]] \
read -r -d '' NEW_BLOCK <<EOF
sieve_script personal {
driver = file
path = ~/sieve
active_path = ~/.dovecot.sieve
type = personal # kann man schreiben, ist aber Default
driver = file
path = ~/sieve
active_path = ~/.dovecot.sieve
}
EOF
replace_or_append_code_block "sieve_script personal" "${NEW_BLOCK}" "${_conf_file}" >> "${log_file}" 2>&1
@@ -7604,6 +7605,8 @@ EOF
# personal
# --------
#
# ** Used by both the Sieve plugin and the ManageSieve protocol **
#
# The personal storage serves as the user's main personal storage. Although more than a single
# personal storage can be defined, only the first one listed in the configuration is used.
#
@@ -7626,9 +7629,10 @@ EOF
# no default script is executed.
sieve_script personal {
driver = file
path = ~/sieve
active_path = ~/.dovecot.sieve
type = personal # kann man schreiben, ist aber Default
driver = file
path = ~/sieve
active_path = ~/.dovecot.sieve
}
EOF
if [[ $? -gt 0 ]]; then
@@ -7638,16 +7642,17 @@ EOF
fi
if grep -qE "^\s*sieve_script\s+before\s*{" "${_conf_file}"; then
if grep -qE "^\s*sieve_script\s+before_spam\s*{" "${_conf_file}"; then
read -r -d '' NEW_BLOCK <<EOF
sieve_script before {
sieve_script before_spam {
type = before
driver = file
path = /usr/local/dovecot/etc/dovecot/sieve/
}
EOF
replace_or_append_code_block "sieve_script before" "${NEW_BLOCK}" "${_conf_file}" >> "${log_file}" 2>&1
replace_or_append_code_block "sieve_script before_spam" "${NEW_BLOCK}" "${_conf_file}" >> "${log_file}" 2>&1
if [[ $? -gt 0 ]]; then
_failed=true
fi
@@ -7676,7 +7681,8 @@ EOF
# A before storage behaves identical to an after storage, except the contained script or
# scripts are run before user's personal script (instead of after).
sieve_script before {
sieve_script before_spam {
type = before
driver = file
path = /usr/local/dovecot/etc/dovecot/sieve/
}
@@ -7688,16 +7694,17 @@ EOF
fi
if grep -qE "^\s*sieve_script\s+global\s*{" "${_conf_file}"; then
if grep -qE "^\s*sieve_script\s+global_includes\s*{" "${_conf_file}"; then
read -r -d '' NEW_BLOCK <<EOF
sieve_script global {
driver = file
path = /usr/local/dovecot/etc/dovecot/sieve/global/
sieve_script global_includes {
type = global
driver = file
path = /usr/local/dovecot/etc/dovecot/sieve/global/
}
EOF
replace_or_append_code_block "sieve_script global" "${NEW_BLOCK}" "${_conf_file}" >> "${log_file}" 2>&1
replace_or_append_code_block "sieve_script global_includes" "${NEW_BLOCK}" "${_conf_file}" >> "${log_file}" 2>&1
if [[ $? -gt 0 ]]; then
_failed=true
fi
@@ -7746,9 +7753,10 @@ EOF
# storages are defined in the configuration until the script is found. The order can be
# overridden by the sieve_script_precedence setting.
sieve_script global {
driver = file
path = /usr/local/dovecot/etc/dovecot/sieve/global/
sieve_script global_includes {
type = global
driver = file
path = /usr/local/dovecot/etc/dovecot/sieve/global/
}
EOF
if [[ $? -gt 0 ]]; then
@@ -10871,24 +10879,27 @@ EOF
replace_or_append_code_block "protocol sieve" "${NEW_BLOCK}" "${_conf_file}" || _failed=true
read -r -d '' NEW_BLOCK <<'EOF'
sieve_script personal {
path = ~/sieve
active_path = ~/.dovecot.sieve
}
EOF
if grep -qE "^\s*sieve_script\s+personal\s+{" "${_conf_file}"; then
replace_code_block "sieve_script personal" "${NEW_BLOCK}" "${_conf_file}" || _failed=true
else
cat <<EOF >> "${_conf_file}" || _failed=true
# Used by both the Sieve plugin and the ManageSieve protocol
${NEW_BLOCK}
EOF
fi
# read -r -d '' NEW_BLOCK <<'EOF'
#sieve_script personal {
# type = personal # kann man schreiben, ist aber Default
# type = personal
# driver = file
# path = ~/sieve
# active_path = ~/.dovecot.sieve
#}
#EOF
# if grep -qE "^\s*sieve_script\s+personal\s+{" "${_conf_file}"; then
#
# replace_code_block "sieve_script personal" "${NEW_BLOCK}" "${_conf_file}" || _failed=true
#
# else
#
# cat <<EOF >> "${_conf_file}" || _failed=true
#
## Used by both the Sieve plugin and the ManageSieve protocol
#${NEW_BLOCK}
#EOF
# fi
if ! $_failed ; then