mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 06:26:57 +00:00
postgresql - delete the datadir once
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
4979d1d90e
commit
6e22b364ae
1 changed files with 7 additions and 1 deletions
|
|
@ -18,10 +18,16 @@ if ! [ -w "$DUMP_DIR" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Delete the datadir once (needed for the migration from debian to alpine)
|
||||||
|
if ! [ -f "$DUMP_DIR/initial-cleanup-done" ]; then
|
||||||
|
rm -rf "${DATADIR:?}/"*
|
||||||
|
touch "$DUMP_DIR/initial-cleanup-done"
|
||||||
|
fi
|
||||||
|
|
||||||
# Test if some things match
|
# Test if some things match
|
||||||
# shellcheck disable=SC2235
|
# shellcheck disable=SC2235
|
||||||
if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSION")" ] ) \
|
if ( [ -f "$DATADIR/PG_VERSION" ] && [ "$PG_MAJOR" != "$(cat "$DATADIR/PG_VERSION")" ] ) \
|
||||||
|| ( ! [ -f "$DATADIR/PG_VERSION" ] && [ -f "$DUMP_FILE" ] ); then
|
|| ( ! [ -f "$DATADIR/PG_VERSION" ] && ( [ -f "$DUMP_FILE" ] || [ -f "$DUMP_DIR/export.failed" ] ) ); then
|
||||||
# The DUMP_file must be provided
|
# The DUMP_file must be provided
|
||||||
if ! [ -f "$DUMP_FILE" ]; then
|
if ! [ -f "$DUMP_FILE" ]; then
|
||||||
echo "Unable to restore the database because the database dump is missing."
|
echo "Unable to restore the database because the database dump is missing."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue