ubuntu.ipxe.j2 4.3 KB

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