From b28b3a8316fd012163d079affb47389c001ed0a8 Mon Sep 17 00:00:00 2001 From: Christoph Date: Tue, 9 Dec 2025 17:49:41 +0100 Subject: [PATCH] install_update_dovecot-2.4.sh: adjust sieve configuration. --- install_update_dovecot-2.4.sh | 83 ++++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/install_update_dovecot-2.4.sh b/install_update_dovecot-2.4.sh index a04d1e3..5484cd7 100755 --- a/install_update_dovecot-2.4.sh +++ b/install_update_dovecot-2.4.sh @@ -7587,9 +7587,10 @@ if [[ $dovecot_major_version -gt 2 ]] \ read -r -d '' NEW_BLOCK <> "${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 <> "${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 <> "${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 <> "${_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 <> "${_conf_file}" || _failed=true +# +## Used by both the Sieve plugin and the ManageSieve protocol +#${NEW_BLOCK} +#EOF +# fi if ! $_failed ; then