submenu "Linux" --class linux {

    regexp -s rootdevice '(.*),' $root
    set root="(${rootdevice},2)"

    submenu "Live" --class linux {

        menuentry "Debian Bookworm 2024271" --class debian {
            set isofile="/debian_bookworm_live_2024271.1289.iso"
            loopback loop $isofile
            linux (loop)/vmlinuz boot=live findiso=$isofile toram=filesystem.squashfs nomodeset quiet splash --
            initrd (loop)/initrd            
        }

        menuentry "SystemRescue 11.02 290824" --class osrecovery {
            set isofile="/systemrescue-11.02-amd64.iso"
            loopback loop $isofile
            probe -u $root --set=uuid
            linux (loop)/sysresccd/boot/x86_64/vmlinuz archisobasedir=sysresccd img_dev=/dev/disk/by-uuid/$uuid img_loop=$isofile iomem=relaxed
            initrd (loop)/sysresccd/boot/intel_ucode.img (loop)/sysresccd/boot/amd_ucode.img (loop)/sysresccd/boot/x86_64/sysresccd.img
        }

        menuentry "Gparted 1.6" --class gparted {
            set isofile="/gparted-live-1.6.0-10-amd64.iso"
            loopback loop $isofile
            linux '(loop)/live/vmlinuz' boot='live' union='overlay' username='user' config components noswap noeject toram='filesystem.squashfs' ip='' findiso=$isofile quiet splash
            initrd '(loop)/live/initrd.img'
        }
    }

    submenu "Solus" --class solus {

        menuentry "Solus 4.5 XFCE" --class solus {
            set iso_path=/Solus-4.5-XFCE-Beta.iso
            search --no-floppy --file ${iso_path} --set

            live_args="for-dracut --> iso-scan/filename=${iso_path}"
            iso_args="initrd=/boot/initrd.img root=live:CDLABEL=SolusLiveXFCEBeta ro rd.luks=0 rd.md=0 rd.live.overlay.overlayfs=1 quiet splash --"

            loopback loop ${iso_path}

            linux (loop)/boot/kernel ${live_args} ${iso_args}
            initrd (loop)/boot/initrd.img
        }
    }

    submenu "Arch Linux" --class arch {

        menuentry "Arch Linux 011024" --class arch {
            set isofile="/archlinux-2024.10.01-x86_64.iso"
            set dri="free"
            search --no-floppy -f --set=root $isofile
            probe -u $root --set=uuid
            loopback loop $isofile
            linux (loop)/arch/boot/x86_64/vmlinuz-linux img_dev=/dev/disk/by-uuid/$uuid img_loop=$isofile quiet splash
            initrd (loop)/arch/boot/x86_64/initramfs-linux.img
        }
    }

    submenu "Debian" --class debian {

        menuentry "Debian 12.7 Install GTK" --class debian {
            set isofile="/debian-12.7.iso"
            loopback loop $isofile
            linux (loop)/install.amd/vmlinuz vga=788 --- quiet splash
            initrd (loop)/install.amd/gtk/initrd.gz
        }

        menuentry "Debian 12.7 Install Terminal" --class debian {
            set isofile="/debian-12.7.iso"
            loopback loop $isofile
            linux (loop)/install.amd/vmlinuz vga=788 --- quiet splash
            initrd (loop)/install.amd/initrd.gz
        }
    }
    
    submenu "Linux Mint" --class linuxmint {

        menuentry "Linux Mint 22 XFCE" --class linuxmint {
            set gfxpayload=keep
            set isofile="/linuxmint-22-xfce-64bit.iso"
            loopback loop $isofile
            linux (loop)/casper/vmlinuz boot=casper username=mint hostname=mint iso-scan/filename=${isofile} quiet splash --
            initrd (loop)/casper/initrd.lz
        }
    }

    submenu "Astra" --class astra {

        menuentry "Astra 1.7 Install GTK" --class astra {
            set isofile="/astra_1.7.iso"
            loopback loop $isofile
            linux (loop)/install.amd/gtk/vmlinuz modprobe.blacklist=evbug astra_install=1  debian-installer/locale=ru debian-installer/language=ru keyboard-configuration/xkb-keymap=ru console-keymaps-at quiet splash
            initrd (loop)/install.amd/gtk/initrd.gz
        }

        menuentry "Astra 1.7 Install Terminal" --class astra {
            set isofile="/astra_1.7.iso"
            loopback loop $isofile
            linux (loop)/install.amd/vmlinuz modprobe.blacklist=evbug astra_install=1  debian-installer/locale=ru debian-installer/language=ru keyboard-configuration/xkb-keymap=ru console-keymaps-at quiet splash
            initrd (loop)/install.amd/initrd.gz
        }

        menuentry "Astra 1.8" --class astra {
            set isofile="/astra_1.8.iso"
            loopback loop $isofile
            linux (loop)/vmlinuz boot=live findiso=$isofile toram=filesystem.squashfs quiet splash
            initrd (loop)/initrd
        }
    }
}
