ubuntu.ipxe.j2 3.3 KB

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