create-installed 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. set -e
  3. cd $(dirname $0)/..
  4. source ./scripts/run-common
  5. INSTALLER=${BASE}/dist/artifacts/installer.tar
  6. if [ ! -e ${INITRD} ]; then
  7. cp bin/ros ${INITRD_SRC}/usr/bin/ros
  8. ./scripts/hash-initrd
  9. pushd ${INITRD_SRC} >/dev/null
  10. find . | cpio -H newc -o | gzip -1 > ${INITRD}
  11. popd >/dev/null
  12. fi
  13. mkdir -p {dist,build/openstack/latest}
  14. cat > build/openstack/latest/user_data << EOF
  15. #!/bin/bash
  16. set -e
  17. trap "poweroff" EXIT
  18. sleep 5
  19. mount -t 9p -o trans=virtio,version=9p2000.L config-2 /mnt
  20. touch log
  21. openvt -s -- tail -f log &
  22. cat /mnt/installer.tar | system-docker load
  23. ros install -d /dev/vda -f --no-reboot >log 2>&1
  24. touch /mnt/success
  25. EOF
  26. rm -f build/{success,hd.img}
  27. qemu-img create -f qcow2 build/hd.img 8G
  28. cp ${INSTALLER} build/installer.tar
  29. qemu-system-${QEMUARCH} -serial stdio \
  30. -enable-kvm \
  31. -drive if=virtio,file=build/hd.img \
  32. -kernel ${KERNEL} \
  33. -initrd ${INITRD} \
  34. -m 2048 \
  35. -append "${DEFAULT_KERNEL_ARGS}" \
  36. -smp 1 \
  37. -nographic \
  38. -display none \
  39. -fsdev local,id=conf,security_model=none,path=$(pwd)/build \
  40. -device virtio-9p-pci,fsdev=conf,mount_tag=config-2
  41. [ -f build/success ]
  42. mkdir -p state
  43. cp build/hd.img state/hd.img