1
0

ubuntu.ipxe.j2 4.4 KB

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