diff --git a/salt/dom0/files/backup/qusal.conf.example b/salt/dom0/files/backup/qusal.conf.example index 8d0f4dc..603e27d 100644 --- a/salt/dom0/files/backup/qusal.conf.example +++ b/salt/dom0/files/backup/qusal.conf.example @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. +# SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. # # SPDX-License-Identifier: AGPL-3.0-or-later @@ -17,10 +17,10 @@ compression: true passphrase_text: my-password destination_vm: backup-ssh -destination_path: ssh backup 'cat | tee -- /dir/qubes-backup-$(date +%Y-%m-%d-%H-%M-%S) >/dev/null' +destination_path: ssh backup -- dd iflag=fullblock conv=sync bs=4M of="/dir/qubes-backup-$(date +%Y-%m-%d-%H-%M-%S)" ## $ qvm-backup-find-last backup-ssh /dir/ 'ssh backup' ## $ qvm-backup-restore --verify-only -d backup-ssh \ -## "ssh backup cat /dir/qubes-backup-file" +## "ssh backup -- cat -- /dir/qubes-backup-file" # vim: ft=yaml diff --git a/salt/dom0/files/bin/qvm-backup-find-last b/salt/dom0/files/bin/qvm-backup-find-last index bfcef73..cd7e32a 100755 --- a/salt/dom0/files/bin/qvm-backup-find-last +++ b/salt/dom0/files/bin/qvm-backup-find-last @@ -36,10 +36,18 @@ cmd="${3-}" find_pattern="qubes-backup-*" find_cmd="find \"${path}\" -maxdepth 1 -type f -name \"${find_pattern}\"" +export LC_ALL=C last_backup="$(list_last_backup)" if test -z "${last_backup}"; then + printf '%s\n' "error: no backup found" >&2 exit 1 fi -printf '%s\n' "${last_backup}" +max_path_size=4096 +path_size=$(printf '%s' "${last_backup}" | wc -c) +if test "${path_size}" -gt "${max_path_size}"; then + printf '%s\n' "error: absolute path larger than ${max_path_size}" >&2 +fi + +printf '%.*s' "${max_path_size}" "${last_backup}"