diff --git a/syslinux-menu.inc b/syslinux-menu.inc index 9891738..7cb046b 100644 --- a/syslinux-menu.inc +++ b/syslinux-menu.inc @@ -16,9 +16,10 @@ function update_syslinux_menu() find_newest "$drive" - > "$mnt"/items.cfg + > "$mnt"/syslinux/items.cfg if [ -n "$newest" ]; then - echo "DEFAULT cloud-init-$newest" >> "$mnt"/items.cfg + version_from_partnum "$drive" "$newest" + echo "DEFAULT cloud-init-$version" >> "$mnt"/syslinux/items.cfg fi partition_list "$drive" @@ -28,12 +29,16 @@ function update_syslinux_menu() continue fi versions["$version"]=1 + missing="" for f in "${files[@]}"; do if [ ! -e "$mnt"/"$imagepath"/"$f""$version" ]; then - continue + missing="1" fi done - cat >> "$mnt"/items.cfg << _EOL_ + if [ -n "$missing" ]; then + continue + fi + cat >> "$mnt"/syslinux/items.cfg << _EOL_ LABEL cloud-init-$version MENU LABEL Ubuntu focal (MAAS $version) diff --git a/syslinux.inc b/syslinux.inc index 230a2e8..d77fbce 100644 --- a/syslinux.inc +++ b/syslinux.inc @@ -47,6 +47,8 @@ function install_syslinux() dd bs=440 count=1 conv=notrunc \ if=/usr/lib/syslinux/mbr/gptmbr.bin of="$drive" + syslinux "$partition" + mount_efi "$drive" # legacy @@ -62,7 +64,6 @@ function install_syslinux() cp syslinux/syslx64.cfg "$mnt"/EFI/BOOT umount_efi - syslinux "$partition" } # vim: set ft=sh: