#!/bin/bash

## Copyright (C) 2023 - 2025 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
## See the file COPYING for copying conditions.

set -x
set -e
set -o errtrace
set -o pipefail
set -o nounset

backup_folder_name="$(qvm-run --pass-io dom0-backup ls /mnt/disk)"
backup_folder_name="$(echo "$backup_folder_name" | tail -1)"

## example backup_folder_name:
## qubes-backup-2023-06-24T103549

backup_folder_full_path="/mnt/disk/${backup_folder_name}"

qvm-backup-restore --verbose --verify-only --dest-vm dom0-backup --passphrase-file ~/password "$backup_folder_full_path"
