Skip to content

Commit 2d7c998

Browse files
wizard: chown .postgres recursively to tolerate a leftover root-owned dir
1 parent 90690ca commit 2d7c998

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎scripts/setup-wizard.sh‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ case "$DB_PROVISION" in
329329
# Pre-create .postgres/ owned by that account so a root wizard can hand the cluster off
330330
# (the script re-execs itself as PG_RUN_USER when invoked as root).
331331
mkdir -p "$ROOT_DIR/.postgres"
332-
[[ $EUID -eq 0 ]] && chown "$APP_USER:$(id -gn "$APP_USER")" "$ROOT_DIR/.postgres"
332+
# Recursive in case a previous (failed) attempt left a root-owned .postgres/ behind.
333+
[[ $EUID -eq 0 ]] && chown -R "$APP_USER:$(id -gn "$APP_USER")" "$ROOT_DIR/.postgres"
333334
DATABASE_URL="$(PG_RUN_USER="$APP_USER" DB_NAME="$DB_NAME" DB_USER="$DB_USER" DB_PASS="$DB_PASS" ./scripts/postgres-local.sh init)"
334335
[[ -n "$DATABASE_URL" ]] || die 'Project-local database provisioning failed.'
335336
ok "Project-local PostgreSQL ready (${DATABASE_URL##*@})"

0 commit comments

Comments
 (0)