diff --git a/file-copy-vm/qvm-copy-to-vm b/file-copy-vm/qvm-copy-to-vm index 2091767..eee5e25 100644 --- a/file-copy-vm/qvm-copy-to-vm +++ b/file-copy-vm/qvm-copy-to-vm @@ -1,4 +1,5 @@ -#!/bin/sh +#!/bin/bash +set -e -o pipefail # # The Qubes OS Project, http://www.qubes-os.org # @@ -28,4 +29,11 @@ fi VM="$1" shift -exec /usr/bin/qvm-run --pass-io --localcmd "/usr/lib/qubes/qfile-dom0-agent $@" "$VM" "QUBESRPC qubes.Filecopy dom0" +TMPDIR=`mktemp -d` +trap 'rm -rf -- "$TMPDIR"' EXIT +RESPONSE=$TMPDIR/response +mkfifo -- "$RESPONSE" + +# can't use $@ with --localcmd, and $* would fail on whitespace +/usr/lib/qubes/qfile-dom0-agent "$@" <"$RESPONSE" | +qvm-run --pass-io "$VM" "QUBESRPC qubes.Filecopy dom0" >"$RESPONSE" diff --git a/file-copy-vm/qvm-move-to-vm b/file-copy-vm/qvm-move-to-vm index 49f4d66..475530f 100644 --- a/file-copy-vm/qvm-move-to-vm +++ b/file-copy-vm/qvm-move-to-vm @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # # The Qubes OS Project, http://www.qubes-os.org # @@ -20,14 +20,5 @@ # # -if [ $# -lt 2 ] ; then - echo usage: $0 'dest_vmname file [file]+' - exit 1 -fi - -VM="$1" -shift - -set -e -/usr/bin/qvm-run --pass-io --localcmd "/usr/lib/qubes/qfile-dom0-agent $@" "$VM" "QUBESRPC qubes.Filecopy dom0" +. qvm-copy-to-vm "$@" && rm -rf -- "$@"