release-vmware 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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.sh dist/publish_gss_${VERSION}.sh dist/publish_gss_latest.sh
  8. chmod 755 dist/publish.sh 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. # In order to be compatible with early links, like /latest/rancheros-vmware.iso, I have to do this.
  13. echo "gsutil cp dist/artifacts/rancheros.iso gs://releases.rancher.com/os/latest/rancheros-vmware.iso" >> ./dist/publish_gss_latest.sh
  14. echo "gsutil cp dist/artifacts/rancheros.iso gs://releases.rancher.com/os/${VERSION}/rancheros-vmware.iso" >> ./dist/publish_gss_${VERSION}.sh
  15. echo "github-release upload --user rancher --repo os --tag ${VERSION} --file dist/artifacts/rancheros.iso --name rancheros-vmware-autoformat.iso" > dist/publish.sh
  16. exit 0
  17. fi
  18. mkdir -p /tmp/dist/openstack/latest ./dist/vmware
  19. cat > /tmp/dist/openstack/latest/user_data << EOF
  20. #!/bin/bash
  21. set -e
  22. trap "poweroff" EXIT
  23. mount -t 9p -o trans=virtio,version=9p2000.L config-2 /mnt
  24. touch log
  25. sleep 5
  26. openvt -s -- tail -f log &
  27. ros install \
  28. -d /dev/vda \
  29. -f \
  30. --no-reboot >log 2>&1
  31. touch /mnt/success
  32. EOF
  33. rm -f /tmp/dist/success
  34. qemu-img create -f qcow2 ./dist/vmware/vmdk.img 8G
  35. kvm -curses \
  36. -drive if=virtio,file=./dist/vmware/vmdk.img \
  37. -cdrom ./dist/artifacts/rancheros.iso \
  38. -m 2048 \
  39. -fsdev local,id=conf,security_model=none,path=/tmp/dist \
  40. -device virtio-9p-pci,fsdev=conf,mount_tag=config-2 \
  41. -device virtio-rng-pci
  42. [ -f /tmp/dist/success ]
  43. echo "Converting ./dist/rancheros.vmdk"
  44. qemu-img convert -f qcow2 -O vmdk ./dist/vmware/vmdk.img ./dist/artifacts/rancheros.vmdk
  45. for file in $(ls dist/artifacts/); do
  46. case $file in
  47. "initrd-"*)
  48. echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/vmware/initrd" >> ./dist/publish_gss_latest.sh
  49. echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/vmware/initrd" >> ./dist/publish_gss_${VERSION}.sh
  50. ;;
  51. "rancheros.iso" | "rancheros.vmdk" | "rootfs.tar.gz")
  52. echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/latest/vmware/${file}" >> ./dist/publish_gss_latest.sh
  53. echo "gsutil cp dist/artifacts/${file} gs://releases.rancher.com/os/${VERSION}/vmware/${file}" >> ./dist/publish_gss_${VERSION}.sh
  54. ;;
  55. esac
  56. done
  57. echo "github-release upload --user rancher --repo os --tag ${VERSION} --file dist/artifacts/rancheros.iso --name rancheros-vmware.iso" >> dist/publish.sh
  58. echo "github-release upload --user rancher --repo os --tag ${VERSION} --file dist/artifacts/rancheros.vmdk --name rancheros-vmware.vmdk" >> dist/publish.sh