Skip to content

Commit c153fed

Browse files
authored
Merge pull request #3174 from nextcloud/enh/3166/grep-syntax
try to fix grep syntax for db restore
2 parents 15da103 + e56b336 commit c153fed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Containers/postgresql/start.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,14 @@ if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSIO
9292

9393
# Check if the line we grep for later on is there
9494
GREP_STRING='Name: oc_appconfig; Type: TABLE; Schema: public; Owner:'
95-
if ! grep -q "$GREP_STRING" "$DUMP_FILE"; then
95+
if ! grep -qa "$GREP_STRING" "$DUMP_FILE"; then
9696
echo "The needed oc_appconfig line is not there which is unexpected."
9797
echo "Please report this to https://github.com/nextcloud/all-in-one/issues. Thanks!"
9898
exit 1
9999
fi
100100

101101
# Get the Owner
102-
DB_OWNER="$(grep "$GREP_STRING" "$DUMP_FILE" | grep -oP 'Owner:.*$' | sed 's|Owner:||;s| ||g')"
102+
DB_OWNER="$(grep -a "$GREP_STRING" "$DUMP_FILE" | grep -oP 'Owner:.*$' | sed 's|Owner:||;s| ||g')"
103103
if [ "$DB_OWNER" = "$POSTGRES_USER" ]; then
104104
echo "Unfortunately was the found database owner of the dump file the same as the POSTGRES_USER $POSTGRES_USER"
105105
echo "It is not possible to import a database dump from this database owner."

0 commit comments

Comments
 (0)