ubuntu.ipxe.j2 3.9 KB

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