ubuntu.ipxe.j2 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. iseq ${ubuntu_version} focal && set dir ${ubuntu_base_dir}/dists/${ubuntu_version}-updates/main/installer-${arch_a}/current/legacy-images/netboot/
  37. goto boot_type
  38. :boot_type
  39. menu ${os} [${ubuntu_version}] Installer
  40. item --gap Install types
  41. item install ${space} Install
  42. item rescue ${space} Rescue Mode
  43. item automated ${space} Specify preseed/autoinstall url...
  44. choose --default ${type} type || goto ubuntu
  45. echo ${cls}
  46. goto deb_${type}
  47. :deb_rescue
  48. iseq ${install_type} deb && set install_params rescue/enable=true ||
  49. iseq ${install_type} sub && set install_params systemd.unit=rescue.target ||
  50. goto deb_install
  51. :deb_automated
  52. echo -n Specify preseed/autoinstall URL for ${os} ${ubuntu_version}: && read autoinstall
  53. iseq ${install_type} deb && set install_params auto=true priority=critical preseed/url=${autoinstall} ||
  54. iseq ${install_type} sub && set install_params autoinstall ds=nocloud-net;s=${autoinstall} ||
  55. goto deb_install
  56. :deb_install
  57. iseq ${install_type} deb && goto deb_boot ||
  58. iseq ${install_type} sub && goto ${ubuntu_version} ||
  59. :deb_boot
  60. echo Loading Ubuntu PXE netboot installer
  61. set dir ${dir}${menu}-installer/${arch_a}
  62. imgfree
  63. kernel ${ubuntu_mirror}/${dir}/linux ${install_params} ${mirrorcfg} -- quiet initrd=initrd.gz ${cmdline}
  64. initrd ${ubuntu_mirror}/${dir}/initrd.gz
  65. echo
  66. echo MD5sums:
  67. md5sum linux initrd.gz
  68. boot
  69. {% for key, value in endpoints.items() | sort %}
  70. {% if value.os == "ubuntu" and 'netboot' in key %}
  71. {% set kernel_name = value.kernel %}
  72. :{{ value.codename }}
  73. {% for key, value in endpoints.items() | sort %}
  74. {% if key == kernel_name %}
  75. set kernel_url ${live_endpoint}{{ value.path }}
  76. set codename {{ value.codename }}
  77. set version_number {{ value.version }}
  78. {% endif %}
  79. {% endfor %}
  80. goto sub_boot
  81. {% endif %}
  82. {% endfor %}
  83. :sub_boot
  84. imgfree
  85. 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
  86. echo Loading Ubuntu Subiquity Network Installer...
  87. kernel ${kernel_url}vmlinuz root=/dev/ram0 ramdisk_size=1500000 ${netboot_params} ${install_params} initrd=initrd ${cmdline}
  88. initrd ${kernel_url}initrd
  89. echo
  90. echo MD5sums:
  91. md5sum vmlinuz initrd
  92. boot
  93. :ubuntu_exit
  94. clear menu
  95. exit 0