diff --git a/install_quota_clone.sh b/install_quota_clone.sh index eba95c9..e296b4e 100755 --- a/install_quota_clone.sh +++ b/install_quota_clone.sh @@ -77,9 +77,19 @@ while true; do done PFA_REAL=$(realpath "$PFA_LINK") -PFA_CONFIG="${PFA_REAL}/config.local.php" 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 ────────────────── [[ -f "$SQL_CONNECT" ]] || die "Not found: $SQL_CONNECT" dbuser=$(grep -E '^\s*user\s*=' "$SQL_CONNECT" | head -1 | sed 's/.*=\s*//' | tr -d '[:space:]') @@ -212,8 +222,6 @@ fi # ── PostfixAdmin ────────────────────────────────────────────────────────────── heading "PostfixAdmin" -[[ -f "$PFA_CONFIG" ]] || die "Not found: $PFA_CONFIG" - # Sets $CONF['key'] = 'val' in config.local.php. # - Already correct value → SKIP # - Present with different value → update in place (perl, only non-commented lines)