From: Frank Brehm Date: Mon, 14 Feb 2022 16:38:19 +0000 (+0100) Subject: Ensuring idempotence X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=b31f5ec63b8549cf1340b80a2ea32f5209ed2ee8;p=pixelpark%2Fldap-migration.git Ensuring idempotence --- diff --git a/migrate-sieve b/migrate-sieve index 2b2a4b0..04035f4 100755 --- a/migrate-sieve +++ b/migrate-sieve @@ -52,6 +52,7 @@ SIEVE_FILE_BASE="Normal.sieve" DOVECOT_SIEVE_FILE_BASE=".dovecot.sieve" declare -a MAIL_DNS=() +declare -A ENSURED_DIRS=() #------------------------------------------------------------------- detect_color() { @@ -435,11 +436,18 @@ LN() { ensure_vmail_dir() { local vdir="$1" + + if [[ -v ENSURED_DIRS[${vdir}] ]] ; then + debug "Directory '${CYAN}${vdir}${NORMAL}' already handled." + return + fi + if [[ ! -d "${vdir}" ]] ; then MKDIR "${vdir}" fi CHMOD 0700 "${vdir}" CHOWN "${VMAIL_USER}:${VMAIL_GROUP}" "${vdir}" + ENSURED_DIRS[${vdir}]="y" }