release-vmware 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #!/bin/bash
  2. set -ex
  3. cd $(dirname $0)/..
  4. touch .make-vmware
  5. source ./scripts/version
  6. ./scripts/release-build
  7. touch dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
  8. chmod 755 dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
  9. if [ "$OS_AUTOFORMAT" = "true" ]; then
  10. echo "gsutil cp dist/artifacts/rancheros.iso gs://releases.rancher.com/os/latest/vmware/rancheros-autoformat.iso" >> ./dist/publish_gss_latest.sh
  11. echo "gsutil cp dist/artifacts/rancheros.iso gs://releases.rancher.com/os/${VERSION}/vmware/rancheros-autoformat.iso" >> ./dist/publish_gss_${VERSION}.sh
  12. echo "gsutil cp dist/artifacts/rancheros.iso gs://releases.rancher.com/os/latest/rancheros-vmware.iso" >> ./dist/publish_gss_latest.sh
  13. echo "gsutil cp dist/artifacts/rancheros.iso gs://releases.rancher.com/os/${VERSION}/rancheros-vmware.iso" >> ./dist/publish_gss_${VERSION}.sh
  14. exit 0
  15. fi
  16. mkdir -p /tmp/dist/openstack/latest ./dist/vmware
  17. cat > /tmp/dist/openstack/latest/user_data << EOF
  18. #!/bin/bash
  19. set -e
  20. trap "poweroff" EXIT
  21. mount -t 9p -o trans=virtio,version=9p2000.L config-2 /mnt
  22. touch log
  23. sleep 5
  24. openvt -s -- tail -f log &
  25. ros install \
  26. -d /dev/vda \
  27. -f \
  28. --no-reboot >log 2>&1
  29. touch /mnt/success
  30. EOF
  31. rm -f /tmp/dist/success
  32. qemu-img create -f qcow2 ./dist/vmware/vmdk.img 8G
  33. kvm -curses \
  34. -drive if=virtio,file=./dist/vmware/vmdk.img \
  35. -cdrom ./dist/artifacts/rancheros.iso \
  36. -m 2048 \
  37. -fsdev local,id=conf,security_model=none,path=/tmp/dist \
  38. -device virtio-9p-pci,fsdev=conf,mount_tag=config-2 \
  39. -device virtio-rng-pci
  40. [ -f /tmp/dist/success ]
  41. echo "Converting ./dist/rancheros.vmdk"
  42. qemu-img convert -f qcow2 -O vmdk ./dist/vmware/vmdk.img ./dist/artifacts/rancheros.vmdk
  43. for file in $(ls dist/artifacts/); do
  44. case $file in
  45. "initrd-"*)
  46. echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/vmware/initrd" >> ./dist/publish_gss_latest.sh
  47. echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/vmware/initrd" >> ./dist/publish_gss_${VERSION}.sh
  48. ;;
  49. "rancheros.iso" | "rancheros.vmdk" | "rootfs.tar.gz")
  50. echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/vmware/${file}" >> ./dist/publish_gss_latest.sh
  51. echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/vmware/${file}" >> ./dist/publish_gss_${VERSION}.sh
  52. ;;
  53. esac
  54. done