1
0

ubuntu.ipxe.j2 4.3 KB

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