Merge branch 'multiple-iso-locations' into 'master'

This commit is contained in:
Eric Teunis de Boone 2023-04-08 11:26:46 +02:00
commit e809b32e67
11 changed files with 246 additions and 84 deletions

View file

@ -2,30 +2,70 @@
#
insmod regexp
set isopath="/boot/isos"
export isopath
set isoconfdir="${isoconfig}.d"
export isoconfdir
if [ -d "${isoconfdir}" ]; then
echo "${isoconfdir} is a directory"
if [ ! -d "${isoconfdir}" ]; then
echo "Cannot read ${isoconfdir}"
exit
fi
# Loop over both FAT32 and ExFAT filesystems
isouuids="EAB6-E0E9 0BB2-9158"
for isouuid in $isouuids
do
echo ""
echo "Searching isoroot on UUID=${isouuid}"
search --no-floppy --fs-uuid --set=isodev $isouuid
set isopath="/isos"
set isoroot="(${isodev})${isopath}"
if [ ! -d "${isoroot}" ]; then
echo "Ignoring invalid iso root at ${isoroot}"
sleep 1
continue
fi
# split isoroot again
echo "Found iso root at ${isoroot}"
regexp \
--set 1:isodev \
--set 2:isopath \
"^(\(.*\))?(.*)\$" "${isoroot}"
echo "isodev: ${isodev}"
echo "isopath: ${isopath}"
# Export the variables
export isoroot
export isopath
export isodev
# Read appropriate iso configs
echo "Reading ${isoconfdir}"
for conf in ${isoconfdir}/*.cfg; do
if [ ! -f "$conf" ]; then
echo "No valid configuration to read"
break;
fi
echo "Sourcing $conf "
#echo "Sourcing $conf "
source "${conf}"
done
sleep 1
done
# let the echos be readable
echo "Waiting for 5 seconds..."
sleep 5
menuentry ' ' { true }
menuentry "[Esc] Back to Menu" {
configfile "${prefix}/grub.cfg"
}
else
echo "Cannot read ${isoconfdir}"
fi

View file

@ -1,14 +1,17 @@
# Alpine Linux Grub config
set isopath_alpine="${isopath}/alpine"
export isopath_alpine
set this_isopath="${isodev}${isopath}/alpine"
for isofile in ${isopath_alpine}/alpine-standard*.iso; do
# abuse for to check for existence
for isofile in ${this_isopath}/alpine-standard*.iso; do
if [ ! -e "$isofile" ]; then break; fi
submenu "Alpine Linux >" --class alpine {
echo "Found Alpines in ${this_isopath}"
for isofile in ${isopath_alpine}/alpine-standard*.iso; do
submenu "Alpine Linux >" "${this_isopath}" --class alpine {
this_isopath=$2
for isofile in ${this_isopath}/alpine-standard*.iso; do
if [ ! -e "$isofile" ]; then break; fi
regexp \
@ -16,13 +19,19 @@ for isofile in ${isopath_alpine}/alpine-standard*.iso; do
--set 2:variant \
--set 3:version \
--set 4:arch \
"^${isopath_alpine}/(alpine-([^-]+)-([^-]+)-([^-]+)\.iso)\$" "${isofile}"
"^.*/(alpine-([^-]+)-([^-]+)-([^-]+)\.iso)\$" "${isofile}"
menuentry "Alpine Linux ${variant} ${version} ${arch}" "${isofile}" "${isoname}" --class alpine {
set isofile=$2
set isoname=$3
regexp \
--set 1:isodev \
--set 2:isofile \
"^(\(.*\))?(.*)\$" "${isofile}"
echo "Using ${isoname}..."
loopback loop $isofile
loopback loop "${isodev}${isofile}"
linux (loop)/boot/grsec initrd=/boot/grsec.gz iso-scan/filename=${isofile} alpine_dev=usbdisk:exfat modules=loop,cramfs,sd-mod,usb-storage
initrd (loop)/boot/grsec.gz
}

View file

@ -1,43 +1,51 @@
# This is the ArchLinux Grub config
# from GLIM
set isopath_archlinux="${isopath}/archlinux"
export isopath_archlinux
set this_isopath="${isodev}${isopath}/archlinux"
# abuse for to check for existence
for isofile in $isopath_archlinux/archlinux*.iso $isopath_archlinux/ipxe*; do
for isofile in ${this_isopath}/archlinux*.iso ${this_isopath}/ipxe*; do
if [ ! -e "$isofile" ]; then break; fi
submenu "ArchLinux >" --class arch {
echo "Found Arches in ${this_isopath}"
submenu "ArchLinux >" "${this_isopath}" --class arch {
this_isopath=$2
menuentry "ArchLinux BIOS netboot" --class arch {
echo "Booting ArchLinux BIOS netboot"
linux16 $isopath_archlinux/ipxe.419cd003a298.lkrn
linux16 ${this_isopath}/ipxe.419cd003a298.lkrn
}
if [ ${grub_platform} == "efi" ]; then
menuentry "ArchLinux EFI netboot" --class arch {
echo "Booting ArchLinux EFI netboot"
chainloader $isopath_archlinux/ipxe.176077d7fccb.efi
chainloader ${this_isopath}/ipxe.176077d7fccb.efi
}
fi
menuentry "" { true }
for isofile in $isopath_archlinux/archlinux-*.iso; do
for isofile in ${this_isopath}/archlinux-*.iso; do
if [ ! -e "$isofile" ]; then break; fi
regexp \
--set 1:isoname \
--set 2:version \
--set 3:arch \
"^${isopath_archlinux}/(archlinux-([^-]+)-([^-]+)\.iso)\$" "${isofile}"
"^.*/(archlinux-([^-]+)-([^-]+)\.iso)\$" "${isofile}"
menuentry "Arch Linux ${version} ${arch}" "${isofile}" "${isoname}" --class arch {
set isofile=$2
set isoname=$3
regexp \
--set 1:isodev \
--set 2:isofile \
"^(\(.*\))?(.*)\$" "${isofile}"
echo "Using ${isoname}..."
loopback loop $isofile
loopback loop "${isodev}${isofile}"
linux (loop)/arch/boot/x86_64/vmlinuz-linux img_dev=/dev/disk/by-uuid/${rootuuid} img_loop=${isofile}
initrd (loop)/arch/boot/intel-ucode.img (loop)/arch/boot/amd-ucode.img (loop)/arch/boot/x86_64/initramfs-linux.img
}

View file

@ -1,29 +1,37 @@
# Bodhi Linux Grub Config
# NOTE: As of 5.0.0 the "legacy" image can't mount FAT32 (charset error)
set isopath_bodhi="bodhi"
export isopath_bodhi
set this_isopath="${isodev}${isopath}/bodhi"
# abuse for to check for existence
for isofile in ${isopath_bodhi}/bodhi-*.iso; do
for isofile in ${this_isopath}/bodhi-*.iso; do
if [ ! -e "$isofile" ]; then break; fi
submenu "Bodhi Linux >" --class bodhi {
echo "Found Bodhis in ${this_isopath}"
for isofile in ${isopath_bodhi}/bodhi-*.iso; do
submenu "Bodhi Linux >" "${this_isopath}" --class bodhi {
this_isopath=$2
for isofile in ${this_isopath}/bodhi-*.iso; do
if [ ! -e "$isofile" ]; then break; fi
regexp \
--set 1:isoname \
--set 2:version \
--set 3:variant \
"^${isopath_bodhi}/(bodhi-([^-]+)-(.+)\.iso)\$" "${isofile}"
"^.*/(bodhi-([^-]+)-(.+)\.iso)\$" "${isofile}"
menuentry "Bodhi ${version} ${variant}" "${isofile}" "${isoname}" --class bodhi {
set isofile=$2
set isoname=$3
regexp \
--set 1:isodev \
--set 2:isofile \
"^(\(.*\))?(.*)\$" "${isofile}"
echo "Using ${isoname}..."
loopback loop $isofile
loopback loop "${isodev}${isofile}"
linux (loop)/casper/vmlinuz iso-scan/filename=${isofile} file=/cdrom/preseed/custom.seed boot=casper quiet splash
initrd (loop)/casper/initrd*
}

View file

@ -1,17 +1,19 @@
# Debian GNU/Linux Grub config
# from GLIM
set isopath_debian='debian'
export isopath_debian
set this_isopath="${isodev}${isopath}/debian"
# abuse for to check for existence
for isofile in ${isopath_debian}/debian-*-netinst.iso ${isopath_debian}/debian-live-*.iso; do
for isofile in ${this_isopath}/debian-*-netinst.iso ${this_isopath}/debian-live-*.iso; do
if [ ! -e "$isofile" ]; then break; fi
submenu "Debian GNU/Linux >" --class debian {
echo "Found Debians in ${isopath}"
submenu "Debian GNU/Linux >" "${this_isopath}" --class debian {
this_isopath=$2
# NetInstall
for isofile in ${isopath_debian}/debian-*-netinst.iso; do
for isofile in ${this_isopath}/debian-*-netinst.iso; do
if [ ! -e "$isofile" ]; then break; fi
regexp \
@ -19,20 +21,26 @@ for isofile in ${isopath_debian}/debian-*-netinst.iso; do
--set 2:version \
--set 3:arch \
--set 4:variant \
"^${isopath_debian}/(debian-([^-]+)-([^-]+)-([^-]+)\.iso)\$" "${isofile}"
"^.*/(debian-([^-]+)-([^-]+)-([^-]+)\.iso)\$" "${isofile}"
menuentry "Debian NetInstall ${version} ${arch}" "${isofile}" "${isoname}" --class debian {
set isofile=$2
set isoname=$3
regexp \
--set 1:isodev \
--set 2:isofile \
"^(\(.*\))?(.*)\$" "${isofile}"
echo "Using ${isoname}..."
loopback loop $isofile
loopback loop "${isodev}${isofile}"
linux (loop)/live/vmlinuz-* findiso=${isofile}
initrd (loop)/live/initrd.img-*
}
done
# Live CD
for isofile in ${isopath_debian}/debian-live-*.iso; do
for isofile in ${this_isopath}/debian-live-*.iso; do
if [ ! -e "$isofile" ]; then break; fi
regexp \
@ -40,13 +48,19 @@ for isofile in ${isopath_debian}/debian-live-*.iso; do
--set 2:version \
--set 3:arch \
--set 4:variant \
"^${isopath_debian}/(debian-live-([^-]+)-([^-]+)-([^-]+)\.iso)\$" "${isofile}"
"^.*/(debian-live-([^-]+)-([^-]+)-([^-]+)\.iso)\$" "${isofile}"
menuentry "Debian Live ${version} ${arch} ${variant}" "${isofile}" "${isoname}" --class debian {
set isofile=$2
set isoname=$3
regexp \
--set 1:isodev \
--set 2:isofile \
"^(\(.*\))?(.*)\$" "${isofile}"
echo "Using ${isoname}..."
loopback loop $isofile
loopback loop "${isodev}${isofile}"
linux (loop)/live/vmlinuz-* boot=live findiso=${isofile} components
initrd (loop)/live/initrd.img-*
}

View file

@ -1,15 +1,18 @@
# Fedora Grub Config
set isopath_fedora="${isopath}/fedora"
export isopath_fedora
set this_isopath="${isodev}${isopath}/fedora"
# abuse for to check for existence
for isofile in ${isopath_fedora}/Fedora-*.iso; do
for isofile in ${this_isopath}/Fedora-*.iso; do
if [ ! -e "$isofile" ]; then break; fi
submenu "Fedora >" --class fedora {
echo "Found Fedoras in ${this_isopath}"
for isofile in ${isopath_fedora}/Fedora-*.iso; do
submenu "Fedora >" "${this_isopath}" --class fedora {
this_isopath=$2
for isofile in ${this_isopath}/Fedora-*.iso; do
if [ ! -e "$isofile" ]; then break; fi
regexp \
@ -17,16 +20,22 @@ for isofile in ${isopath_fedora}/Fedora-*.iso; do
--set 2:variant \
--set 3:arch \
--set 4:version \
"^${isopath_fedora}/(Fedora-([^-]+)-Live-([^-]+)-([^-]+)-[^-]+\.iso)\$" "${isofile}"
"^.*/(Fedora-([^-]+)-Live-([^-]+)-([^-]+)-[^-]+\.iso)\$" "${isofile}"
menuentry "Fedora ${version} ${arch} ${variant}" "${isofile}" "${isoname}" --class fedora {
set isofile=$2
set isoname=$3
regexp \
--set 1:isodev \
--set 2:isofile \
"^(\(.*\))?(.*)\$" "${isofile}"
echo "Using ${isoname}..."
loopback loop $isofile
loopback loop "${isodev}${isofile}"
probe --set isolabel --label (loop)
linux (loop)/isolinux/vmlinuz root=live:CDLABEL=${isolabel} rd.live.image iso-scan/filename=${isofile} rhgb ro
initrd (loop)/isolinux/initrd.img
linux (loop)/images/pxeboot/vmlinuz root=live:CDLABEL=${isolabel} rd.live.image iso-scan/filename=${isofile} rhgb ro
initrd (loop)/images/pxeboot/initrd.img
}
done
}

View file

@ -1,37 +1,52 @@
# Kali Grub config
# from GLIM
set isopath_kali="kali"
export isopath_kali
set this_isopath="${isodev}${isopath}/kali"
# abuse for to check for existence
for isofile in $isopath_kali/kali-linux-*.iso; do
for isofile in ${this_isopath}/kali-linux-*.iso; do
if [ ! -e "$isofile" ]; then break; fi
submenu "Kali Linux >" --class kali {
echo "Found Kali Linuxes in ${this_isopath}"
for isofile in ${isopath_kali}/kali-linux-*.iso; do
submenu "Kali Linux >" "${this_isopath}" --class kali {
this_isopath=$2
for isofile in ${this_isopath}/kali-linux-*.iso; do
if [ ! -e "$isofile" ]; then break; fi
regexp \
--set 1:isoname \
--set 2:version \
--set 3:arch \
"^${isopath_kali}/(kali-linux-([^-]+)-([^-]+)\.iso)\$" "${isofile}"
"^.*/(kali-linux-([^-]+)-([^-]+)\.iso)\$" "${isofile}"
menuentry "Kali ${version} ${arch}" "${isofile}" "${isoname}" --class kali {
set isofile=$2
set isoname=$3
regexp \
--set 1:isodev \
--set 2:isofile \
"^(\(.*\))?(.*)\$" "${isofile}"
echo "Using ${isoname}..."
loopback loop $isofile
linux (loop)/live/vmlinuz-*-amd64 findiso=${isofile} boot=live components splash username=root hostname=kali
loopback loop "${isodev}${isofile}"
linux (loop)/live/vmlinuz-*-amd64 fromiso=${isofile} boot=live components splash username=root hostname=kali
initrd (loop)/live/initrd.img-*-amd64
}
menuentry "Kali ${version} ${arch} (forensic mode)" "${isofile}" "${isoname}" --class kali {
set isofile=$2
set isoname=$3
regexp \
--set 1:isodev \
--set 2:isofile \
"^(\(.*\))?(.*)\$" "${isofile}"
echo "Using ${isoname}..."
loopback loop $isofile
linux (loop)/live/vmlinuz-*-amd64 findiso=${isofile} boot=live components splash username=root hostname=kali noswap noautomount
loopback loop "${isodev}${isofile}"
linux (loop)/live/vmlinuz-*-amd64 fromiso=${isofile} boot=live components splash username=root hostname=kali noswap noautomount
initrd (loop)/live/initrd.img-*-amd64
}
done

View file

@ -1,30 +1,37 @@
# Tails Grub config
# from GLIM
set isopath_tails="${isopath}/tails"
export isopath_tails
set this_isopath="${isodev}${isopath}/tails"
# abuse for to check for existence
for isofile in $isopath_tails/tails-*.iso; do
for isofile in ${this_isopath}/tails-*.iso; do
if [ ! -e "$isofile" ]; then break; fi
submenu "Tails" --class tails {
echo "Found Tailses in ${this_isopath}"
for isofile in $isopath_tails/tails-*.iso; do
submenu "Tails" "${this_isopath}" --class tails {
this_isopath=$2
for isofile in ${this_isopath}/tails-*.iso; do
if [ ! -e "$isofile" ]; then break; fi
echo "$isofile exists"
regexp \
--set 1:isoname \
--set 2:arch \
--set 3:version \
"^${isopath_tails}/(tails-([^-]+)-([^-]+)\.iso)\$" "${isofile}"
"^.*/(tails-([^-]+)-([^-]+)\.iso)\$" "${isofile}"
menuentry "Tails ${version} ${arch}" "${isofile}" "${isoname}" --class tails {
set isofile=$2
set isoname=$3
regexp \
--set 1:isodev \
--set 2:isofile \
"^(\(.*\))?(.*)\$" "${isofile}"
echo "Using ${isoname}..."
loopback loop $isofile
loopback loop "${isodev}${isofile}"
linux (loop)/live/vmlinuz boot=live live-media=removable findiso=${isofile} config apparmor=1 security=apparmor nopersistence noprompt timezone=Etc/UTC block.events_dfl_poll_msecs=1000 splash noautologin module=Tails kaslr slab_nomerge slub_debug=FZP mce=0 vsyscall=none page_poison=1 union=aufs quiet
initrd (loop)/live/initrd.img
}

View file

@ -1,29 +1,37 @@
# TinyCore Grub Config
set isopath_tinycore="${isopath}/tinycore"
export isopath_tinycore
set this_isopath="${isodev}${isopath}/tinycore"
# abuse for to check for existence
for isofile in $isopath_tinycore/*.iso; do
for isofile in $this_isopath/*.iso; do
if [ ! -e "$isofile" ]; then break; fi
submenu "TinyCore Linux >" --class tinycore {
echo "Found TinyCores in ${this_isopath}"
for isofile in ${isopath_tinycore}/*Core*.iso; do
submenu "TinyCore Linux >" "${this_isopath}" --class tinycore {
this_isopath=$2
for isofile in ${this_isopath}/*Core*.iso; do
if [ ! -e "$isofile" ]; then break; fi
regexp \
--set 1:isoname \
--set 2:variant \
--set 3:version \
"^${isopath_tinycore}/((.*Core[^-]*)-(.+)\.iso)\$" "${isofile}"
"^.*/((.*Core[^-]*)-(.+)\.iso)\$" "${isofile}"
menuentry "${variant} ${version}" "${isofile}" "${isoname}" --class tinycore {
set isofile=$2
set isoname=$3
regexp \
--set 1:isodev \
--set 2:isofile \
"^(\(.*\))?(.*)\$" "${isofile}"
echo "Using ${isoname}..."
loopback loop $isofile
loopback loop "${isodev}${isofile}"
# ideas to add for CorePlus: loglevel=3 cde showapps desktop=flwm_topside
linux (loop)/boot/vmlinuz
initrd (loop)/boot/core.gz

View file

@ -0,0 +1,44 @@
# Ubuntu Grub Config
set this_isopath="${isodev}${isopath}/ubuntu"
# abuse for to check for existence
for isofile in ${this_isopath}/ubuntu-*.iso; do
if [ ! -e "$isofile" ]; then break; fi
echo "Found Ubuntus in ${this_isopath}"
submenu "Ubuntu >" "${this_isopath}" --class ubuntu {
this_isopath=$2
for isofile in ${this_isopath}/ubuntu-*.iso; do
if [ ! -e "$isofile" ]; then break; fi
regexp \
--set 1:isoname \
--set 2:version \
--set 3:variant \
--set 4:arch \
"^.*/(ubuntu-([^-]+)-(.*)-([^-]+)\.iso)\$" "${isofile}"
menuentry "Ubuntu ${version} ${arch} ${variant}" "${isofile}" "${isoname}" --class ubuntu {
set isofile=$2
set isoname=$3
regexp \
--set 1:isodev \
--set 2:isofile \
"^(\(.*\))?(.*)\$" "${isofile}"
echo "Using ${isoname}..."
loopback loop "${isodev}${isofile}"
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=${isofile} quiet splash
initrd (loop)/casper/initrd*
}
done
}
# kill for loop
break
done