Release new version 0.6.1
[grml-rescueboot.git] / 42_grml
diff --git a/42_grml b/42_grml
index 7fc45ba..7b96e6b 100755 (executable)
--- a/42_grml
+++ b/42_grml
@@ -74,10 +74,17 @@ get_dependencies() {
     break
   done
   echo $dependencies
-
 }
 
-
+get_iso_identifier() {
+  local iso="$1"
+  local id=
+  if isoinfo --version >/dev/null 2>&1 ; then
+    id=$(isoinfo -d -i "${iso}" | grep '^Volume id:' | sed -e 's/^[^:]*: *//')
+    [ -n "${id}" ] || id=$(isoinfo -d -i "${iso}" | grep '^Application id:' | sed -e 's/^[^:]*: *//')
+  fi
+  echo "${id}"
+}
 
 iso_list=""
 for file in "${ISO_LOCATION}"/*.iso ; do
@@ -117,22 +124,33 @@ for grmliso in $iso_list ; do
     ;;
   esac
 
-  echo "Found Grml ISO image: $grmliso" >&2
-  title="Grml Rescue System ($grml)"
+  echo "Found grml-rescueboot ISO image: ${grmliso}" >&2
+  iso_id=$(get_iso_identifier "${grmliso}")
+  if [ -n "${iso_id}" ] ; then
+    title="${iso_id} (${grml})"
+  else
+    title="${grml}"
+  fi
   grub_prep=$(prepare_grub_to_access_device "${device}" | sed -e "s/^/${indent}/")
+  grub_iso_path="${rel_dirname%/}/${grml}"
 
   sed -e "s/^/${submenu_indent}/" << EOF
 menuentry "${title}" {
 ${grub_prep}
-        iso_path="${rel_dirname%/}/${grml}"
+        iso_path="${grub_iso_path}"
         export iso_path
         kernelopts=" $CUSTOM_BOOTOPTIONS $additional_param "
         export kernelopts
         # support booting recent GRUB versions on UEFI systems
+        # (see bugs.debian.org/959425)
         rmmod tpm
-        loopback loop "${rel_dirname%/}/$grml"
+        loopback loop "\$iso_path"
         set root=(loop)
         configfile /boot/grub/loopback.cfg
+        unset root
+        loopback -d loop
+        unset iso_path
+        unset kernelopts
 }
 EOF
 done