install_quota_clone.sh: enhance config.local.php detection logic for PostfixAdmin

This commit is contained in:
2026-06-29 16:49:59 +02:00
parent 4c9a34d234
commit d917dc69bb
+11 -3
View File
@@ -77,9 +77,19 @@ while true; do
done done
PFA_REAL=$(realpath "$PFA_LINK") PFA_REAL=$(realpath "$PFA_LINK")
PFA_CONFIG="${PFA_REAL}/config.local.php"
info "PFA : $PFA_REAL" info "PFA : $PFA_REAL"
# config.local.php is either in PFA_REAL itself (symlink → PFA root)
# or one level up (symlink → public/ document root)
if [[ -f "${PFA_REAL}/config.local.php" ]]; then
PFA_CONFIG="${PFA_REAL}/config.local.php"
elif [[ -f "$(dirname "${PFA_REAL}")/config.local.php" ]]; then
PFA_CONFIG="$(dirname "${PFA_REAL}")/config.local.php"
else
die "config.local.php not found in $PFA_REAL nor in $(dirname "$PFA_REAL")"
fi
info "Config : $PFA_CONFIG"
# ── read DB credentials from Dovecot's sql-connect.conf.ext ────────────────── # ── read DB credentials from Dovecot's sql-connect.conf.ext ──────────────────
[[ -f "$SQL_CONNECT" ]] || die "Not found: $SQL_CONNECT" [[ -f "$SQL_CONNECT" ]] || die "Not found: $SQL_CONNECT"
dbuser=$(grep -E '^\s*user\s*=' "$SQL_CONNECT" | head -1 | sed 's/.*=\s*//' | tr -d '[:space:]') dbuser=$(grep -E '^\s*user\s*=' "$SQL_CONNECT" | head -1 | sed 's/.*=\s*//' | tr -d '[:space:]')
@@ -212,8 +222,6 @@ fi
# ── PostfixAdmin ────────────────────────────────────────────────────────────── # ── PostfixAdmin ──────────────────────────────────────────────────────────────
heading "PostfixAdmin" heading "PostfixAdmin"
[[ -f "$PFA_CONFIG" ]] || die "Not found: $PFA_CONFIG"
# Sets $CONF['key'] = 'val' in config.local.php. # Sets $CONF['key'] = 'val' in config.local.php.
# - Already correct value → SKIP # - Already correct value → SKIP
# - Present with different value → update in place (perl, only non-commented lines) # - Present with different value → update in place (perl, only non-commented lines)