34 lines
1.2 KiB
Bash
34 lines
1.2 KiB
Bash
#!/bin/sh
|
|
ESP_MNT=/boot/efi
|
|
ISO_REL=/iso
|
|
ISO_PATH=${ESP_MNT}/${ISO_REL}
|
|
# df command needs warm up due to systemd mount-on-demand
|
|
ls $ISO_PATH 1> /dev/null
|
|
ESP_UUID=$(blkid -s UUID -o value $(df --output=source ${ISO_PATH} | tail -n +2))
|
|
cat <<EOF
|
|
submenu 'archiso' {
|
|
configfile \$prefix/archiso.cfg
|
|
}
|
|
EOF
|
|
tee /boot/grub/archiso.cfg 1> /dev/null <<EOF
|
|
insmod search_fs_uuid
|
|
set isorootuuid=$ESP_UUID
|
|
search --fs-uuid --no-floppy --set=isopart \$isorootuuid
|
|
set isopath=$ISO_REL
|
|
EOF
|
|
ISO_NUM=0
|
|
for isofile in $ISO_PATH/archlinux-*.iso; do
|
|
if [ "$ISO_NUM" -gt 300 ]; then break; fi
|
|
isoname=${isofile##*/}
|
|
tee -a /boot/grub/archiso.cfg 1> /dev/null <<EOF
|
|
menuentry "$isoname" {
|
|
loopback loop0 (\$isopart)\$isopath/$isoname
|
|
linux (loop0)/arch/boot/x86_64/vmlinuz-linux earlymodules=loop img_dev=/dev/disk/by-uuid/\$isorootuuid img_loop=\$isopath/$isoname
|
|
initrd (loop0)/arch/boot/intel-ucode.img (loop0)/arch/boot/amd-ucode.img (loop0)/arch/boot/x86_64/initramfs-linux.img
|
|
}
|
|
EOF
|
|
ISO_NUM=$(( $ISO_NUM + 1 ))
|
|
done
|
|
# archiso kernel cmdline from
|
|
# https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/configs/releng/efiboot/loader/entries/archiso-x86_64-linux.conf
|