fix: separate host commands with end of options

This commit is contained in:
Ben Grande 2025-03-19 15:14:06 +01:00
parent b82a63e0ac
commit 9300c46def
No known key found for this signature in database
GPG Key ID: 00C64E14F51F9E56
2 changed files with 12 additions and 4 deletions

View File

@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2023 - 2024 Benjamin Grande M. S. <ben.grande.b@gmail.com>
# SPDX-FileCopyrightText: 2023 - 2025 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# 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

View File

@ -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}"