ubuntu.ipxe.j2 3.2 KB

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