qvm-copy-to-vm 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/sh
  2. set -e
  3. #
  4. # The Qubes OS Project, http://www.qubes-os.org
  5. #
  6. # Copyright (C) 2010 Rafal Wojtczuk <rafal@invisiblethingslab.com>
  7. #
  8. # This program is free software; you can redistribute it and/or
  9. # modify it under the terms of the GNU General Public License
  10. # as published by the Free Software Foundation; either version 2
  11. # of the License, or (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  21. #
  22. #
  23. if [ $# -lt 2 ] ; then
  24. echo usage: $0 '[--without-progress] dest_vmname file [file]+'
  25. exit 1
  26. fi
  27. if [ "$1" = "--without-progress" ] ; then
  28. export PROGRESS_TYPE=none
  29. shift
  30. else
  31. export PROGRESS_TYPE=console
  32. fi
  33. VM="$1"
  34. shift
  35. if [ $PROGRESS_TYPE = console ] ; then
  36. export FILECOPY_TOTAL_SIZE=$(du --apparent-size -c -- "$@" 2> /dev/null | tail -1 | cut -f 1)
  37. fi
  38. /usr/lib/qubes/qrexec-client-vm "$VM" qubes.Filecopy /usr/lib/qubes/qfile-agent "$@"
  39. if [ "${0##*/}" = "qvm-move-to-vm" ]; then
  40. rm -rf -- "$@"
  41. fi