mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-02-02 19:08:14 +08:00
Merge pull request #3174 from nextcloud/enh/3166/grep-syntax
try to fix grep syntax for db restore
This commit is contained in:
commit
c153fed44d
1 changed files with 2 additions and 2 deletions
|
@ -92,14 +92,14 @@ if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSIO
|
|||
|
||||
# Check if the line we grep for later on is there
|
||||
GREP_STRING='Name: oc_appconfig; Type: TABLE; Schema: public; Owner:'
|
||||
if ! grep -q "$GREP_STRING" "$DUMP_FILE"; then
|
||||
if ! grep -qa "$GREP_STRING" "$DUMP_FILE"; then
|
||||
echo "The needed oc_appconfig line is not there which is unexpected."
|
||||
echo "Please report this to https://github.com/nextcloud/all-in-one/issues. Thanks!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get the Owner
|
||||
DB_OWNER="$(grep "$GREP_STRING" "$DUMP_FILE" | grep -oP 'Owner:.*$' | sed 's|Owner:||;s| ||g')"
|
||||
DB_OWNER="$(grep -a "$GREP_STRING" "$DUMP_FILE" | 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."
|
||||
|
|
Loading…
Reference in a new issue