]> Frank Brehm's Git Trees - pixelpark/ldap-migration.git/commitdiff
Compiling Sieve files
authorFrank Brehm <frank@brehm-online.com>
Mon, 14 Feb 2022 16:49:11 +0000 (17:49 +0100)
committerFrank Brehm <frank@brehm-online.com>
Mon, 14 Feb 2022 16:49:11 +0000 (17:49 +0100)
migrate-sieve

index 04035f4a34c2025352d21da106845cfb580bf57c..8a74d18d0733f01d424064b01d0726801efb5274 100755 (executable)
@@ -50,6 +50,7 @@ VMAIL_USER='vmail'
 VMAIL_GROUP='vmail'
 SIEVE_FILE_BASE="Normal.sieve"
 DOVECOT_SIEVE_FILE_BASE=".dovecot.sieve"
+COMPILED_SIEVE_BASE=".dovecot.svbin"
 
 declare -a MAIL_DNS=()
 declare -A ENSURED_DIRS=()
@@ -543,6 +544,7 @@ migrate_entry() {
     local domain_dir="${VMAIL_ROOT_DIR}/${domain}"
     local mailbox_dir="${domain_dir}/${mail_address}"
     local dovecot_sieve_file="${mailbox_dir}/${DOVECOT_SIEVE_FILE_BASE}"
+    local compiled_sieve="${mailbox_dir}/${COMPILED_SIEVE_BASE}"
     local sieve_dir="${mailbox_dir}/sieve"
     local sieve_file="${sieve_dir}/${SIEVE_FILE_BASE}"
     local dovecot_link_target="sieve/${SIEVE_FILE_BASE}"
@@ -603,6 +605,17 @@ migrate_entry() {
         ls -l "${color_param}" "${dovecot_sieve_file}"
     fi
 
+    info "Compiling '${CYAN}${dovecot_sieve_file}${NORMAL}' ..."
+    debug "Executing: sievec \"${dovecot_sieve_file}\""
+    if [[ "${SIMULATE}" != "y" ]] ; then
+        sievec "${dovecot_sieve_file}"
+    fi
+    CHOWN "${VMAIL_USER}:${VMAIL_GROUP}" "${compiled_sieve}"
+    CHMOD 0600 "${compiled_sieve}"
+    if [[ -e "${compiled_sieve}" && "${QUIET}" != "y" ]] ; then
+        ls -l "${color_param}" "${compiled_sieve}"
+    fi
+
 }
 
 #------------------------------------------------