1
0

ubuntu.ipxe.j2 3.9 KB

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