feat: move helpers to qusal

This commit is contained in:
Ben Grande 2024-02-23 16:42:56 +01:00
parent b3ccfdc3de
commit 835c5a9097
No known key found for this signature in database
GPG Key ID: 00C64E14F51F9E56
3 changed files with 0 additions and 79 deletions

View File

@ -1,29 +0,0 @@
#!/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 "${@}"

View File

@ -1 +0,0 @@
qvm-terminal

View File

@ -1,49 +0,0 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
set -eu
me="${0##*/}"
usage(){
printf '%s\n' "Usage: ${me} [QVM-RUN_OPTIONS] QUBE
Examples:
${me} --dispvm=DVM_TEMPLATE
${me} -u root QUBE
${me} QUBE" >&2
exit "${1-"1"}"
}
case "${me}" in
*-terminal) service=qubes-run-terminal ;;
*-file-manager) service=qubes-open-file-manager ;;
*) printf '%s\n' "Invalid script name: ${me}" exit 1 ;;
esac
case "${1-}" in
-h|--help)
usage 1
;;
"")
## Try to run on focused window, if Dom0 is focused, it will prompt you to
## select a qube window.
id="$(xdotool getwindowfocus)"
qube="$(xprop -id "${id}" -notype _QUBES_VMNAME | awk -F '"' '{print $2}')"
if test -n "${qube}"; then
exec qvm-run --service -- "${qube}" "qubes.StartApp+${service}"
fi
echo "Select a qube window ..."
id="$(xdotool selectwindow)"
qube="$(xprop -id "${id}" -notype _QUBES_VMNAME | awk -F '"' '{print $2}')"
if test -n "${qube}"; then
qvm-run --service -- "${qube}" "qubes.StartApp+${service}"
fi
;;
*)
qvm-run --service "${@}" -- "qubes.StartApp+${service}"
;;
esac