ubuntu.ipxe.j2 3.6 KB

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