From 96d8914c837acfd4078c4adbf9346efcd03541f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Sun, 15 Jul 2018 23:15:38 +0200 Subject: [PATCH 1/2] Add proper help text to qvm-copy tools and fix incorrect behavior for qvm-move Added more descriptive usage text to the qvm-copy/qvm-move/qvm-copy-to-vm/qvm-move-to-vm family of tools. Also fixed bug that removed the file being moved for qvm-move-to-vm, but not for qvm-move. fixes QubesOS/qubes-issues#3529 fixes QubesOS/qubes-issues#4020 --- qubes-rpc/qvm-copy-to-vm | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/qubes-rpc/qvm-copy-to-vm b/qubes-rpc/qvm-copy-to-vm index 196d1d4..058322d 100755 --- a/qubes-rpc/qvm-copy-to-vm +++ b/qubes-rpc/qvm-copy-to-vm @@ -22,7 +22,23 @@ set -e # if [ $# -lt 2 ] ; then - echo "usage: $0 [--without-progress] dest_vmname file [file]+" + + if [ "${0##*/}" = "qvm-move-to-vm" ] || [ "${0##*/}" = "qvm-copy-to-vm" ]; then + echo "usage: $0 [--without-progress] destination_vmname FILE [FILE ...]" + else + echo "usage: $0 [--without-progress] FILE [FILE ...]" + fi + + echo + + if [ "${0##*/}" = "qvm-move-to-vm" ] || [ "${0##*/}" = "qvm-move" ] ; then + echo "Move FILE to ~/QubesIncoming/$(hostname)/ in the destination qube." + else + echo "Copy FILE to ~/QubesIncoming/$(hostname)/ in the destination qube." + fi + + echo + echo "You will be prompted to select the destination qube. If FILE is a directory, it will be copied recursively." exit 1 fi @@ -49,6 +65,6 @@ fi /usr/lib/qubes/qrexec-client-vm "$VM" qubes.Filecopy /usr/lib/qubes/qfile-agent "$@" -if [ "${0##*/}" = "qvm-move-to-vm" ]; then +if [ "${0##*/}" = "qvm-move-to-vm" ] || [ "${0##*/}" = "qvm-move" ] ; then rm -rf -- "$@" fi From 99f239ea9e58ea287b5444a28feeee9d5ee6f70d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marta=20Marczykowska-G=C3=B3recka?= Date: Sun, 15 Jul 2018 23:46:37 +0200 Subject: [PATCH 2/2] Avoid leaking VM name in qvm-copy usage text Do not display name of the qube in the usage text. --- qubes-rpc/qvm-copy-to-vm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/qubes-rpc/qvm-copy-to-vm b/qubes-rpc/qvm-copy-to-vm index 058322d..7208e3e 100755 --- a/qubes-rpc/qvm-copy-to-vm +++ b/qubes-rpc/qvm-copy-to-vm @@ -22,23 +22,23 @@ set -e # if [ $# -lt 2 ] ; then - + if [ "${0##*/}" = "qvm-move-to-vm" ] || [ "${0##*/}" = "qvm-copy-to-vm" ]; then - echo "usage: $0 [--without-progress] destination_vmname FILE [FILE ...]" + echo "usage: $0 [--without-progress] destination_qube_name FILE [FILE ...]" else echo "usage: $0 [--without-progress] FILE [FILE ...]" fi - + echo if [ "${0##*/}" = "qvm-move-to-vm" ] || [ "${0##*/}" = "qvm-move" ] ; then - echo "Move FILE to ~/QubesIncoming/$(hostname)/ in the destination qube." + echo "Move FILE to ~/QubesIncoming/[THIS QUBE'S NAME]/ in the destination qube." else - echo "Copy FILE to ~/QubesIncoming/$(hostname)/ in the destination qube." + echo "Copy FILE to ~/QubesIncoming/[THIS QUBE'S NAME]/ in the destination qube." fi - - echo - echo "You will be prompted to select the destination qube. If FILE is a directory, it will be copied recursively." + + echo + echo "You will be prompted to select the destination qube. If FILE is a directory, it will be copied recursively." exit 1 fi