mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-20 14:36:52 +00:00
improve instance restore for when nextcloud_datadir is set/not set
Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
parent
0d4152a7f9
commit
68fd14bc86
2 changed files with 11 additions and 2 deletions
|
|
@ -191,6 +191,13 @@ if [ "$BORG_MODE" = restore ]; then
|
||||||
# Save current path
|
# Save current path
|
||||||
BORG_LOCATION="$(jq '.borg_backup_host_location' /nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json)"
|
BORG_LOCATION="$(jq '.borg_backup_host_location' /nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json)"
|
||||||
|
|
||||||
|
# Save current nextcloud datadir
|
||||||
|
if grep -q '"nextcloud_datadir":' /nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json; then
|
||||||
|
NEXTCLOUD_DATADIR="$(jq '.nextcloud_datadir' /nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json)"
|
||||||
|
else
|
||||||
|
NEXTCLOUD_DATADIR='""'
|
||||||
|
fi
|
||||||
|
|
||||||
# Restore the configuration file
|
# Restore the configuration file
|
||||||
if ! rsync --archive --human-readable -vv \
|
if ! rsync --archive --human-readable -vv \
|
||||||
/tmp/borg/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json \
|
/tmp/borg/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json \
|
||||||
|
|
@ -212,6 +219,10 @@ if [ "$BORG_MODE" = restore ]; then
|
||||||
CONTENTS="$(jq ".password = $AIO_PASSWORD" /nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json)"
|
CONTENTS="$(jq ".password = $AIO_PASSWORD" /nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json)"
|
||||||
echo -E "${CONTENTS}" > /nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json
|
echo -E "${CONTENTS}" > /nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json
|
||||||
|
|
||||||
|
# Reset the datadir to the one that was used for the restore
|
||||||
|
CONTENTS="$(jq ".nextcloud_datadir = $NEXTCLOUD_DATADIR" /nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json)"
|
||||||
|
echo -E "${CONTENTS}" > /nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/configuration.json
|
||||||
|
|
||||||
umount /tmp/borg
|
umount /tmp/borg
|
||||||
|
|
||||||
# Inform user
|
# Inform user
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,8 @@ fi
|
||||||
rm -f "/nextcloud_aio_volumes/nextcloud_aio_database_dump/backup-is-running"
|
rm -f "/nextcloud_aio_volumes/nextcloud_aio_database_dump/backup-is-running"
|
||||||
|
|
||||||
# Get a list of all available borg archives
|
# Get a list of all available borg archives
|
||||||
set -x
|
|
||||||
borg list "$BORG_BACKUP_DIRECTORY" | grep "nextcloud-aio" | awk -F " " '{print $1","$3,$4}' > "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/backup_archives.list"
|
borg list "$BORG_BACKUP_DIRECTORY" | grep "nextcloud-aio" | awk -F " " '{print $1","$3,$4}' > "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/backup_archives.list"
|
||||||
chmod +r "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/backup_archives.list"
|
chmod +r "/nextcloud_aio_volumes/nextcloud_aio_mastercontainer/data/backup_archives.list"
|
||||||
set +x
|
|
||||||
|
|
||||||
if [ -n "$FAILED" ]; then
|
if [ -n "$FAILED" ]; then
|
||||||
if [ "$BORG_MODE" = backup ]; then
|
if [ "$BORG_MODE" = backup ]; then
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue