mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-04 14:54:07 +02:00
upgrade
This commit is contained in:
@@ -39,5 +39,5 @@
|
|||||||
"slug": "postgres",
|
"slug": "postgres",
|
||||||
"udev": true,
|
"udev": true,
|
||||||
"url": "https://github.com/alexbelgium/hassio-addons/tree/master/postgres",
|
"url": "https://github.com/alexbelgium/hassio-addons/tree/master/postgres",
|
||||||
"version": "15.7-37"
|
"version": "15.7-37_test"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ RESTART_FLAG_FILE="$CONFIG_HOME/restart_needed"
|
|||||||
|
|
||||||
# Ensure permissions and folder structure
|
# Ensure permissions and folder structure
|
||||||
|
|
||||||
mkdir -p "$PGDATA"
|
|
||||||
|
|
||||||
fix_permissions(){
|
fix_permissions(){
|
||||||
|
mkdir -p "$PGDATA"
|
||||||
chown -R postgres:postgres "$PGDATA"
|
chown -R postgres:postgres "$PGDATA"
|
||||||
chmod 700 "$PGDATA"
|
chmod 700 "$PGDATA"
|
||||||
}
|
}
|
||||||
@@ -91,11 +90,11 @@ upgrade_postgres_if_needed() {
|
|||||||
bashio::log.info "Stopping old Postgres ($CLUSTER_VERSION)"
|
bashio::log.info "Stopping old Postgres ($CLUSTER_VERSION)"
|
||||||
su - postgres -c "$BINARIES_DIR/$CLUSTER_VERSION/bin/pg_ctl -w -D '$PGDATA' stop"
|
su - postgres -c "$BINARIES_DIR/$CLUSTER_VERSION/bin/pg_ctl -w -D '$PGDATA' stop"
|
||||||
|
|
||||||
fix_permissions
|
|
||||||
|
|
||||||
# Move aside data directory
|
# Move aside data directory
|
||||||
rm -rf "$PGDATA"
|
rm -rf "$PGDATA"
|
||||||
|
|
||||||
|
fix_permissions
|
||||||
|
|
||||||
# Init new cluster
|
# Init new cluster
|
||||||
bashio::log.info "Initializing new data cluster for $IMAGE_VERSION"
|
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'"
|
su - postgres -c "$BINARIES_DIR/$IMAGE_VERSION/bin/initdb --encoding=$ENCODING --lc-collate=$LC_COLLATE --lc-ctype=$LC_CTYPE -D '$PGDATA'"
|
||||||
|
|||||||
Reference in New Issue
Block a user