ubuntu.ipxe.j2 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #!ipxe
  2. # Ubuntu Operating System
  3. # https://www.ubuntu.com
  4. goto ${menu}
  5. :ubuntu
  6. set os Ubuntu
  7. set os_arch ${arch}
  8. iseq ${os_arch} x86_64 && set os_arch amd64 ||
  9. iseq ${os_arch} arm64 && set os_arch arm64 ||
  10. clear ubuntu_version
  11. clear install_type
  12. clear older_release
  13. clear install_url
  14. set install_type deb
  15. set install_priority critical
  16. menu ${os} - ${os_arch}
  17. item --gap Latest Releases
  18. {% for item in releases.ubuntu.versions %}
  19. item {{ item.code_name }} ${space} ${os} {{ item.name }}
  20. {% endfor %}
  21. item --gap Older Releases
  22. item older_release ${space} Set release codename...
  23. choose ubuntu_version || goto ubuntu_exit
  24. iseq ${ubuntu_version} older_release && goto older_release ||
  25. iseq ${ubuntu_version} focal && set install_type sub ||
  26. iseq ${ubuntu_version} jammy && set install_type sub ||
  27. iseq ${ubuntu_version} kinetic && set install_type sub ||
  28. iseq ${ubuntu_version} lunar && set install_type sub ||
  29. iseq ${ubuntu_version} focal-legacy && set ubuntu_version focal ||
  30. iseq ${install_type} sub && goto boot_type ||
  31. iseq ${os_arch} arm64 && echo "arm64 not supported on legacy network installs, please use 20.04 Subiquity and up" && sleep 5 && goto ubuntu ||
  32. goto mirrorcfg
  33. :older_release
  34. set older_release true
  35. set ubuntu_mirror {{ releases.ubuntu.archive_mirror }}
  36. echo Setting mirror to ${ubuntu_mirror}
  37. clear ubuntu_version
  38. echo -n Please set enter code name of release: ${} && read ubuntu_version
  39. set dir ${ubuntu_base_dir}/dists/${ubuntu_version}-updates/main/installer-${os_arch}/current/images/netboot/
  40. goto boot_type
  41. :mirrorcfg
  42. set mirrorcfg mirror/suite=${ubuntu_version}
  43. set dir ${ubuntu_base_dir}/dists/${ubuntu_version}-updates/main/installer-${os_arch}/current/images/netboot/
  44. iseq ${ubuntu_version} focal && set dir ${ubuntu_base_dir}/dists/${ubuntu_version}-updates/main/installer-${os_arch}/current/legacy-images/netboot/ ||
  45. goto boot_type
  46. :boot_type
  47. menu ${os} [${ubuntu_version}] Installer
  48. item --gap Install types
  49. item install ${space} Install
  50. item rescue ${space} Rescue Mode
  51. item automated ${space} Specify preseed/autoinstall url...
  52. iseq ${install_type} deb && item priority ${space} Change install priority [ ${install_priority} ] ||
  53. choose --default ${type} type || goto ubuntu
  54. echo ${cls}
  55. goto deb_${type}
  56. :deb_rescue
  57. iseq ${install_type} deb && set install_params rescue/enable=true ||
  58. iseq ${install_type} sub && set install_params systemd.unit=rescue.target ||
  59. goto deb_install
  60. :deb_priority
  61. iseq ${install_priority} critical && set install_priority low || set install_priority critical
  62. goto boot_type
  63. :deb_automated
  64. iseq ${install_type} deb && set install_name preseed ||
  65. iseq ${install_type} sub && set install_name autoinstall ||
  66. echo -n Specify ${install_name} URL for ${os} ${ubuntu_version}: && read install_url
  67. iseq ${install_type} deb && set install_params auto=true priority=${install_priority} preseed/url=${install_url} ||
  68. iseq ${install_type} sub && set install_params autoinstall ds=nocloud-net;s=${install_url} ||
  69. goto deb_install
  70. :deb_install
  71. iseq ${install_type} deb && goto deb_boot ||
  72. iseq ${install_type} sub && goto ${ubuntu_version}_${os_arch} ||
  73. :deb_boot
  74. echo Loading Ubuntu PXE netboot installer
  75. set dir ${dir}ubuntu-installer/${os_arch}
  76. imgfree
  77. kernel ${ubuntu_mirror}/${dir}/linux ${install_params} ${mirrorcfg} {{ kernel_params }}
  78. initrd ${ubuntu_mirror}/${dir}/initrd.gz
  79. echo
  80. echo MD5sums:
  81. md5sum linux initrd.gz
  82. boot
  83. {% for key, value in endpoints.items() | sort %}
  84. {% if value.os == "ubuntu" and 'netboot' in key %}
  85. {% set kernel_name = value.kernel %}
  86. :{{ value.codename }}_{{ value.arch }}
  87. {% for key, value in endpoints.items() | sort %}
  88. {% if key == kernel_name %}
  89. set kernel_url ${live_endpoint}{{ value.path }}
  90. set codename {{ value.codename }}
  91. set version_number {{ value.version }}
  92. {% endif %}
  93. {% endfor %}
  94. goto sub_boot
  95. {% endif %}
  96. {% endfor %}
  97. :sub_boot
  98. imgfree
  99. iseq ${os_arch} amd64 && set ubuntu_iso_url http://releases.ubuntu.com/${codename}/ubuntu-${version_number}-live-server-${os_arch}.iso ||
  100. iseq ${os_arch} arm64 && set ubuntu_iso_url http://cdimage.ubuntu.com/releases/${version_number}/release/ubuntu-${version_number}-live-server-${os_arch}.iso ||
  101. isset ${dhcp-server} && set netboot_params ip=dhcp url=${ubuntu_iso_url} || set netboot_params
  102. echo Loading Ubuntu Subiquity Network Installer...
  103. kernel ${kernel_url}vmlinuz root=/dev/ram0 ramdisk_size=1500000 ${netboot_params} ${install_params} {{ kernel_params }}
  104. initrd ${kernel_url}initrd
  105. echo
  106. echo MD5sums:
  107. md5sum vmlinuz initrd
  108. boot
  109. :ubuntu_exit
  110. clear menu
  111. exit 0