Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Allow restoring specific backups

Manav Rathi5c4c6f2677b3
diff --git a/infra/copycat-db/src/restore.sh b/infra/copycat-db/src/restore.sh
index 8df19c62b2..6fa1a21a2f 100755
--- a/infra/copycat-db/src/restore.sh
+++ b/infra/copycat-db/src/restore.sh
@@ -3,9 +3,16 @@
set -o errexit
set -o xtrace
-# Find the name of the latest backup
-# The backup file name contains the epoch, so we can just sort.
-BACKUP_FILE=$(rclone lsf --include 'db-*.custom' --files-only $RCLONE_DESTINATION | sort | tail -1)
+if test -z "$1"; then
+ # Find the name of the latest backup.
+ #
+ # The backup file name contains the epoch, so we can just sort.
+ BACKUP_FILE=$(rclone lsf --include 'db-*.custom' --files-only $RCLONE_DESTINATION | sort | tail -1)
+else
+ # If a CLI argument is provided, use that as the name of the backup file to
+ # restore.
+ BACKUP_FILE="$1"
+fi
# Download it
rclone copy --log-level INFO "${RCLONE_DESTINATION}${BACKUP_FILE}" .