From 0d821882c5b339e1d436c0e03ea22bd05c52e1fe Mon Sep 17 00:00:00 2001 From: alexbelgium Date: Thu, 29 May 2025 16:54:46 +0200 Subject: [PATCH] upgrade --- postgres/config.json | 2 +- postgres/rootfs/etc/cont-init.d/99-run.sh | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/postgres/config.json b/postgres/config.json index b6a376d44..d47b630b1 100644 --- a/postgres/config.json +++ b/postgres/config.json @@ -39,5 +39,5 @@ "slug": "postgres", "udev": true, "url": "https://github.com/alexbelgium/hassio-addons/tree/master/postgres", - "version": "15.7-37" + "version": "15.7-37_test" } diff --git a/postgres/rootfs/etc/cont-init.d/99-run.sh b/postgres/rootfs/etc/cont-init.d/99-run.sh index 2e3484601..c5c70f4fa 100755 --- a/postgres/rootfs/etc/cont-init.d/99-run.sh +++ b/postgres/rootfs/etc/cont-init.d/99-run.sh @@ -12,9 +12,8 @@ RESTART_FLAG_FILE="$CONFIG_HOME/restart_needed" # Ensure permissions and folder structure -mkdir -p "$PGDATA" - fix_permissions(){ + mkdir -p "$PGDATA" chown -R postgres:postgres "$PGDATA" chmod 700 "$PGDATA" } @@ -91,11 +90,11 @@ upgrade_postgres_if_needed() { bashio::log.info "Stopping old Postgres ($CLUSTER_VERSION)" su - postgres -c "$BINARIES_DIR/$CLUSTER_VERSION/bin/pg_ctl -w -D '$PGDATA' stop" - fix_permissions - # Move aside data directory rm -rf "$PGDATA" + fix_permissions + # Init new cluster bashio::log.info "Initializing new data cluster for $IMAGE_VERSION" su - postgres -c "$BINARIES_DIR/$IMAGE_VERSION/bin/initdb --encoding=$ENCODING --lc-collate=$LC_COLLATE --lc-ctype=$LC_CTYPE -D '$PGDATA'"