mirror of
https://github.com/ben-grande/qusal.git
synced 2024-12-26 07:59:37 -05:00
f513f64065
These helpers were in the dotfiles submodule, but they are very useful and makes sense to port them to this project, especially when in need to update Qusal. Fixes: https://github.com/ben-grande/qusal/issues/18 Fixes: https://github.com/ben-grande/qusal/issues/21
30 lines
873 B
Bash
Executable File
30 lines
873 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
## Copy a file from an DomU to Dom0. Script has to be run in Dom0
|
|
set -eu
|
|
|
|
usage(){
|
|
echo "usage: ${0##*/} <QUBE> <FILE> <FILE2...>
|
|
note: disk quota is capped and can be controlled via environment variables:
|
|
note: UPDATES_MAX_BYTES (default: 4GiB)
|
|
note: UPDATES_MAX_FILES (default: 2048)" >&2
|
|
exit 1
|
|
}
|
|
|
|
test -n "${2-}" || usage
|
|
qube="${1}"
|
|
shift
|
|
|
|
dir="${HOME}/QubesIncoming/${qube}"
|
|
user="$(qvm-prefs --get -- "${qube}" default_user)"
|
|
max_bytes="${UPDATES_MAX_BYTES:-4GiB}"
|
|
max_files="${UPDATES_MAX_FILES:-2048}"
|
|
qvm-run --pass-io --localcmd="
|
|
UPDATES_MAX_BYTES=\"${max_bytes}\" UPDATES_MAX_FILES=\"${max_files}\"
|
|
/usr/libexec/qubes/qfile-dom0-unpacker \"${user}\" \"${dir}\"" \
|
|
"${qube}" /usr/lib/qubes/qfile-agent "${@}"
|