From a622fcc894e97cba54e43663f1907764361b5a83 Mon Sep 17 00:00:00 2001 From: Simon L Date: Thu, 20 Jun 2024 14:18:09 +0200 Subject: [PATCH] database-restore: only get the first match Signed-off-by: Simon L. --- Containers/postgresql/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Containers/postgresql/start.sh b/Containers/postgresql/start.sh index 97eab9a0..10e46550 100644 --- a/Containers/postgresql/start.sh +++ b/Containers/postgresql/start.sh @@ -99,7 +99,7 @@ if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSIO fi # Get the Owner - DB_OWNER="$(grep -a "$GREP_STRING" "$DUMP_FILE" | grep -oP 'Owner:.*$' | sed 's|Owner:||;s| ||g')" + DB_OWNER="$(grep -a "$GREP_STRING" "$DUMP_FILE" | head -1 | grep -oP 'Owner:.*$' | sed 's|Owner:||;s| ||g')" if [ "$DB_OWNER" = "$POSTGRES_USER" ]; then echo "Unfortunately was the found database owner of the dump file the same as the POSTGRES_USER $POSTGRES_USER" echo "It is not possible to import a database dump from this database owner."