From a1f4c276bc9f2b8083691aa1a58ccbb38e93cf68 Mon Sep 17 00:00:00 2001
From: Holger Paradies <retabell@gmx.de>
Date: Fri, 1 Nov 2019 12:09:51 +0100
Subject: provide simple loopback.cfg

without search
---
 config/binary_grub/loopback.cfg         | 135 ++++++++++++++++++++++++++++++++
 config/binary_local-hooks/grub2-configs |   1 +
 2 files changed, 136 insertions(+)
 create mode 100644 config/binary_grub/loopback.cfg

diff --git a/config/binary_grub/loopback.cfg b/config/binary_grub/loopback.cfg
new file mode 100644
index 0000000..b69cb37
--- /dev/null
+++ b/config/binary_grub/loopback.cfg
@@ -0,0 +1,135 @@
+echo Loading...
+set default=0
+set timeout=8
+
+set boot_en='boot=live config utc=yes locales=en_US.UTF-8'
+set boot_de='boot=live config utc=no timezone=Europe/Berlin locales=de_DE.UTF-8,en_US.UTF-8 keyboard-layouts=de keyboard-variants=nodeadkeys'
+set search_file='kanotix*.iso'
+set isofile=''
+
+if loadfont /boot/grub/unicode.pf2 ; then
+  set gfxmode=800x600
+  if [ $efi != 1 ] ; then
+    insmod vbe
+    insmod vga
+  else
+    insmod efi_gop
+    insmod efi_uga
+  fi
+  insmod video_bochs
+  insmod video_cirrus
+  insmod gfxterm
+  terminal_output gfxterm
+  echo Loading...
+fi
+
+insmod png
+if background_image /boot/grub/kanotix-logo.png; then
+  set color_normal=white/black
+  set color_highlight=white/light-blue
+else
+  set menu_color_normal=cyan/blue
+  set menu_color_highlight=white/blue
+fi
+
+insmod part_msdos
+insmod btrfs
+set persistence=0
+if test -e ($root,msdos3) ; then
+  if search --label --set persistence --no-floppy persistence ($root,msdos3) ; then
+    if test -e (${persistence})/grub.cmdline ; then
+      source (${persistence})/grub.cmdline
+      insmod regexp
+      set lmp=live
+      regexp --set=lmp 'live-media-path=\([^ ]*\)' "${persistence_cmdline}"
+      if test -d /$lmp ; then
+        menuentry 'Start Kanotix (persistent)' {
+      echo    'Loading Linux ...'
+      linux   /$lmp/vmlinuz ${persistence_cmdline}
+      echo    'Loading initial ramdisk ...'
+      initrd  /$lmp/initrd.img
+        }
+      fi
+    fi
+  fi
+fi
+
+if [ ${iso_path} ] ; then
+    set loopback="findiso=${iso_path}"
+fi
+
+#####
+menuentry 'Start Kanotix DE' {
+        echo    'Loading Linux ...'
+        linux   /live/vmlinuz ${boot_de} ${loopback} quiet splash
+        echo    'Loading initial ramdisk ...'
+        initrd  /live/initrd.img
+}
+
+menuentry 'Start Kanotix EN' {
+        echo    'Loading Linux ...'
+        linux   /live/vmlinuz ${boot_en} ${loopback} quiet splash
+        echo    'Loading initial ramdisk ...'
+        initrd  /live/initrd.img
+}
+
+menuentry 'Start Kanotix DE (failsafe)' {
+        echo    'Loading Linux ...'
+        linux   /live/vmlinuz ${boot_de} ${loopback} quiet splash noapic noapm nodma nomce nolapic nomodeset nosmp vga=normal
+        echo    'Loading initial ramdisk ...'
+        initrd  /live/initrd.img
+}
+
+menuentry 'Start Kanotix EN (failsafe)' {
+        echo    'Loading Linux ...'
+        linux   /live/vmlinuz ${boot_en} ${loopback} quiet splash noapic noapm nodma nomce nolapic nomodeset nosmp vga=normal
+        echo    'Loading initial ramdisk ...'
+        initrd  /live/initrd.img
+}
+
+#####
+
+if [ $efi != 1 ] ; then
+  menuentry 'Memtest86+' {
+        linux16 /live/memtest
+  }
+else
+  if test -f /efi/boot/shellx64.efi ; then
+    menuentry 'EFI Shell x64' {
+          chainloader /efi/boot/shellx64.efi
+    }
+  fi
+  if test -f /efi/boot/shellia32.efi ; then
+    menuentry 'EFI Shell x86' {
+          chainloader /efi/boot/shellia32.efi
+    }
+  fi
+  insmod regexp
+  for grub in (*)/EFI/*/grub*.efi; do
+  if [ -e "$grub" ]; then
+   regexp --set=device '(\(.*\))' "$grub"
+   menuentry "Boot GRUB UEFI loader from device $device" "$device" "$grub" {
+    set root="$2"
+    chainloader "$3"
+   }
+  fi
+ done
+  for bootmgfw in (*)/EFI/Microsoft/Boot/bootmgfw.efi; do
+   if [ -e "$bootmgfw" ]; then
+    regexp --set=device '(\(.*\))' "$bootmgfw"
+    menuentry "Boot Windows UEFI from device $device" "$device" "$bootmgfw" {
+     root="$2"
+     chainloader "$3"
+    }
+   fi
+  done
+  for gummiboot in (*)/EFI/gummiboot/gummiboot*.efi; do
+  if [ -e "$gummiboot" ]; then
+   regexp --set=device '(\(.*\))' "$gummiboot"
+   menuentry "Boot Gummiboot UEFI loader from device $device" "$device" "$gummiboot" {
+    set root="$2"
+    chainloader "$3"
+   }
+  fi
+ done
+fi
diff --git a/config/binary_local-hooks/grub2-configs b/config/binary_local-hooks/grub2-configs
index f6276fe..32b286b 100755
--- a/config/binary_local-hooks/grub2-configs
+++ b/config/binary_local-hooks/grub2-configs
@@ -13,6 +13,7 @@ if [ -f config/binary_grub/grub.cfg ]
 then
 	mkdir -p binary/boot/grub
         cp config/binary_grub/grub*.cfg binary/boot/grub/
+        cp config/binary_grub/loopback.cfg binary/boot/grub/
 fi
 
 . config/chroot
-- 
cgit v1.0