ubuntu.ipxe.j2 3.6 KB

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