aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2013-03-27 13:18:44 +0100
committerLaurent Ghigonis <laurent@p1sec.com>2013-03-27 13:18:44 +0100
commite75629cda700b2b2cdbc28a59691692615303f49 (patch)
tree596a1d127438d8dd1004323311774a6e7865d944
parentpropagate: move to broken/ (diff)
downloadlaurent-tools-e75629cda700b2b2cdbc28a59691692615303f49.tar.xz
laurent-tools-e75629cda700b2b2cdbc28a59691692615303f49.zip
add qvm-copy-to-vm.sh, to copy files from Qubes Dom0 to AppVM
-rw-r--r--tools/qvm-copy-to-vm.sh40
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/qvm-copy-to-vm.sh b/tools/qvm-copy-to-vm.sh
new file mode 100644
index 0000000..29e9a68
--- /dev/null
+++ b/tools/qvm-copy-to-vm.sh
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+# Copy files from Qubes Dom0 to AppVM
+# 2013, Laurent Ghigonis <laurent@p1sec.com>
+
+APPVM_DEST_DIR="/home/user/QubesIncoming/dom0"
+
+usage() {
+ echo "$program [-hn] dest_vmname file [file]+"
+ echo -e "\t-n : run nautilus in dest_vmname"
+}
+
+program="`basename $0`"
+mode_nautilus=0
+opts="$(getopt -o hn -n "$program" -- "$@")"
+err=$?
+eval set -- "$opts"
+while true; do case $1 in
+ -h) usage; exit 1 ;;
+ -n) mode_nautilus=1; shift ;;
+ --) shift; break ;;
+esac done
+[[ $err -ne 0 || $# -lt 2 ]] && usage && exit 1
+
+appvm="$1"
+shift
+
+echo "[-] copy to AppVM $appvm"
+qvm-run $appvm "mkdir -p $APPVM_DEST_DIR"
+for f in $@; do
+ echo "[-] copying $APPVM_DEST_DIR/$f"
+ cat $f |qvm-run --pass-io $appvm "cat > $APPVM_DEST_DIR/$f"
+done
+
+if [ $mode_nautilus -eq 1 ]; then
+ echo "[-] running nautilus in AppVM"
+ qvm-run $appvm "nautilus $APPVM_DEST_DIR"
+fi
+
+echo "[*] done"