ubuntu.ipxe.j2 4.5 KB

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