You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

make-clean-vm 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/sh
  2. set -e
  3. SUITE=lucid
  4. ARCH=amd64
  5. VMSW=KVM
  6. if [ -n "$USE_LXC" ]; then
  7. VMSW=LXC
  8. elif [ -n "$USE_VBOX" ]; then
  9. VMSW=VBOX
  10. fi
  11. usage() {
  12. echo "Usage: ${0##*/} [OPTION]..."
  13. echo "Make a clean copy of the base client."
  14. echo
  15. cat << EOF
  16. --help display this help and exit
  17. --suite U build suite U instead of lucid
  18. --arch A build architecture A (e.g. i386) instead of amd64
  19. EOF
  20. }
  21. if [ $# != 0 ] ; then
  22. while true ; do
  23. case "$1" in
  24. --help|-h)
  25. usage
  26. exit 0
  27. ;;
  28. --suite|-s)
  29. SUITE="$2"
  30. shift 2
  31. ;;
  32. --arch|-a)
  33. ARCH="$2"
  34. shift 2
  35. ;;
  36. --*)
  37. echo "unrecognized option $1"
  38. exit 1
  39. ;;
  40. *)
  41. break
  42. ;;
  43. esac
  44. done
  45. fi
  46. BASE=base-$SUITE-$ARCH
  47. OUT=target-$SUITE-$ARCH
  48. case $VMSW in
  49. KVM)
  50. qemu-img create -f qcow2 -o backing_file="$BASE.qcow2" "$OUT.qcow2"
  51. ;;
  52. LXC)
  53. cp -a $BASE $OUT
  54. on-target -u root bash < target-bin/bootstrap-fixup
  55. ;;
  56. VBOX)
  57. VBoxManage snapshot "Gitian-${SUITE}-${ARCH}" restore "Gitian-Clean"
  58. ;;
  59. esac