#!/bin/sh
-# Filename: 42_grml
-# Purpose: grub-mkconfig helper script for Grml rescue systems
+# Filename: 42_loopback-iso
+# Purpose: grub-mkconfig helper script for loopback.cfg-compatible ISOs
# Authors: Grml team (grml.org), (c) Andreas Gredler <jimmy@grml.org>, Michael Prokop <mika@grml.org>
# License: This file is licensed under the GPL v2+.
################################################################################
fi
# default unless configured otherwise:
-ISO_LOCATION="/boot/grml"
+ISO_LOCATION="/boot/isos"
+# grml-rescueboot backwards compatibility
+if [ -d /boot/grml ]; then
+ ISO_LOCATION="${ISO_LOCATION} /boot/grml"
+fi
+
+if [ -r /etc/default/grub-loopback-isos ] ; then
+ . /etc/default/grub-loopback-isos
+fi
+
+# grml-rescueboot backwards compatibility
if [ -r /etc/default/grml-rescueboot ] ; then
. /etc/default/grml-rescueboot
fi
iso_list=""
-for file in "${ISO_LOCATION}"/*.iso ; do
+for dir in $ISO_LOCATION; do
+ for file in "$dir"/*.iso ; do
if grub_file_is_not_garbage "$file" ; then
iso_list="$iso_list $file "
fi
+ done
done
-for grmliso in $iso_list ; do
- rel_dirname="$(make_system_path_relative_to_its_root $(dirname $grmliso))"
- grml="$(basename $grmliso)"
- device="$(${grub_probe} -t device ${grmliso})"
+for iso in $iso_list ; do
+ rel_dirname="$(make_system_path_relative_to_its_root $(dirname $iso))"
+ isofn="$(basename $iso)"
+ device="$(${grub_probe} -t device ${iso})"
additional_param=""
;;
esac
- echo "Found Grml ISO image: $grmliso" >&2
- title="Grml Rescue System ($grml)"
+ echo "Found Loopback ISO image: $iso" >&2
+ title="Bootable ISO ($isofn)"
grub_prep=$(prepare_grub_to_access_device "$device" | sed -e "s/^/ /")
cat << EOF
menuentry "${title}" {
${grub_prep}
- iso_path="${rel_dirname}/${grml}"
+ iso_path="${rel_dirname}/${isofn}"
export iso_path
kernelopts=" $CUSTOM_BOOTOPTIONS $additional_param "
export kernelopts
- loopback loop "${rel_dirname}/$grml"
+ loopback loop "${rel_dirname}/$isofn"
set root=(loop)
configfile /boot/grub/loopback.cfg
}
* standarized support for custom options (so it works e.g. with Ubuntu as well)
-* set bootentry title within GRUB based on ISO (so e.g. "Grml" becomes "Ubuntu")
-The Debian Package grml-rescueboot
-==================================
-
-Usually systems are rescued with CD or USB stick. grml-rescueboot makes
-it possible to simply copy an Grml ISO image to the harddisk and boot the
-rescue image. This eliminates the need to carry around a USB stick
-to rescue a system as long as the hard disk and the boot manager still
-work.
-
-grml-rescueboot includes the script 42_grml which is installed in
-/etc/grub.d and run when update-grub is executed. The script looks for
-ISO images in /boot/grml/ and adds an entry for each image found.
-
-Howto
------
-
-- Get a recent Grml image from http://grml.org/download/
-- Copy the image to /boot/grml
-- Run update-grub
-- Reboot and enjoy your new rescue system
-
-Limitations
------------
-
-grml-rescueboot uses the loopback feature of GRUB2, so it won't work
-with legacy GRUB. Furthermore the ISO image needs to support
-loopback.cfg, a file which is placed in /boot/grub/. Grml supports
-loopback.cfg beginning with release version 2010.04.
-
-More technical details can be found here:
-http://www.supergrubdisk.org/wiki/Loopback.cfg
-
-Create your own ISO
--------------------
-
-You can make your own Grml Live ISO image using the grml-live
-build framework. Visit http://grml.org/grml-live/ and
-http://grml.org/ for more information.
+== About ==
+
+grub-loopback-iso is a GRUB 2 configuration hook to boot compatible
+ISOs stored on the host filesystem. The stanzas built utilize GRUB
+2's loopback mount support to chain a /boot/grub/loopback.cfg file on
+an ISO.
+
+== Installation ==
+
+Place compatible ISOs in a suitable location. By default, this is
+/boot/isos, but may be changed by editing /etc/default/grub-loopback-iso
+(for example, if the /boot partition is too small). However, keep in
+mind that the ISO's operating system may have restrictions on what type
+of partition the ISO may be placed on; it is the ISO's operating system
+(initrd most likely) which is responsible for finding the ISO by
+scanning partitions, so the partition and filesystem must be known to
+the ISO operating system.
+
+Then simply run "update-grub", and verify the correct stanzas have been
+created in /boot/grub/grub.cfg .
-Source: grml-rescueboot
+Source: grub-loopback-iso
Section: admin
Priority: extra
Maintainer: Grml Team <team@grml.org>
Vcs-git: git://git.grml.org/grml-rescueboot.git
Vcs-Browser: http://git.grml.org/?p=grml-rescueboot.git
-Package: grml-rescueboot
+Package: grub-loopback-iso
Architecture: all
Depends: grub-pc | grub-efi-amd64,
${misc:Depends},
${shlibs:Depends}
-Description: Integrates Grml ISO booting into GRUB
- This package provides a script for update-grub which looks for
- Grml ISO images in /boot/grml and automatically adds an entry
- for each image. The purpose is to use one of those images to
- boot a Grml rescue system without using a CD or USB stick.
+Replaces: grml-rescueboot (<< 0.4.6~)
+Breaks: grml-rescueboot (<< 0.4.6~)
+Description: Boot a compatible loopback ISO from GRUB 2
+ grub-loopback-iso is a GRUB 2 configuration hook to boot compatible
+ ISOs stored on the host filesystem. The stanzas built utilize GRUB
+ 2's loopback mount support to chain a /boot/grub/loopback.cfg file on
+ an ISO.
+
+Package: grml-rescueboot
+Depends: grub-loopback-iso, ${misc:Depends}
+Architecture: all
+Section: oldlibs
+Description: transitional dummy package
+ This is a transitional dummy package. It can safely be removed.
+++ /dev/null
-/boot/grml
+++ /dev/null
-# Shipping /boot/grml (empty) is intentional.
-grml-rescueboot binary: package-contains-empty-directory boot/grml/
--- /dev/null
+/boot/isos
--- /dev/null
+42_loopback-iso etc/grub.d/
+debian/README usr/share/doc/grub-loopback-iso/
+etc/default etc/
--- /dev/null
+# Shipping /boot/isos (empty) is intentional.
+grub-loopback-iso binary: package-contains-empty-directory boot/isos/
#!/bin/sh
-# postinst script for grml-rescueboot
+# postinst script for grub-loopback-iso
set -e
update_grub_wrapper() {
- # default, unless configured otherwise:
- ISO_LOCATION=/boot/grml
+ # default unless configured otherwise:
+ ISO_LOCATION="/boot/isos"
+ # grml-rescueboot backwards compatibility
+ if [ -d /boot/grml ]; then
+ ISO_LOCATION="${ISO_LOCATION} /boot/grml"
+ fi
+
+ if [ -r /etc/default/grub-loopback-isos ] ; then
+ . /etc/default/grub-loopback-isos
+ fi
+
+ # grml-rescueboot backwards compatibility
if [ -r /etc/default/grml-rescueboot ] ; then
. /etc/default/grml-rescueboot
fi
- if ! ls "${ISO_LOCATION}"/*iso >/dev/null 2>&1 ; then
+ iso_list=""
+ for dir in $ISO_LOCATION; do
+ for file in "$dir"/*.iso ; do
+ [ -e "$file" ] || continue
+ iso_list="$iso_list $file"
+ done
+ done
+
+ if [ -z "$iso_list" ]; then
echo "INFO: No *.iso files found inside ${ISO_LOCATION}."
echo "INFO: Please create ${ISO_LOCATION} and place rescue ISO(s) there."
echo "INFO: Finally invoke update-grub and enjoy your rescue system."
#!/bin/sh
-# postrm script for grml-rescueboot
+# postrm script for grub-loopback-iso
set -e
--- /dev/null
+#!/bin/sh
+# preinst script for grub-loopback-iso
+
+set -e
+
+remove_old_grubd() {
+ # Old grml-rescueboot 42_grml is saved upon upgrade as a conffile.
+ # Remove it if it matches known default hashes; otherwise warn.
+ [ -e /etc/grub.d/42_grml ] || return
+
+ default_grubd=""
+ case "$(md5sum /etc/grub.d/42_grml | cut -d' ' -f1)" in
+ 1db35de0d6dddb149bd609689ef98b30) # 0.4.2
+ default_grubd=yes
+ ;;
+ c1afca4d42c494a7421c27ad9fb731fd) # 0.4.4
+ default_grubd=yes
+ ;;
+ ecc549965cc4b4d0d762a3ba6dfe7cb5) # 0.4.5
+ default_grubd=yes
+ ;;
+ esac
+
+ if [ -n "$default_grubd" ]; then
+ rm -f /etc/grub.d/42_grml
+ return
+ else
+ echo >&2
+ echo "WARNING: /etc/grub.d/42_grml appears to have been modified." >&2
+ echo "Please remove it and/or purge the transitional grml-rescueboot package." >&2
+ echo >&2
+ fi
+}
+
+case "$1" in
+ install|upgrade)
+ remove_old_grubd
+ ;;
+esac
+
+#DEBHELPER#
+
+exit 0
+++ /dev/null
-42_grml etc/grub.d/
-debian/README usr/share/doc/grml-rescueboot/
-etc/default etc/
+++ /dev/null
-## Configuration file for Debian package grml-rescueboot.
-
-# Location of ISOs:
-# ISO_LOCATION="/boot/grml/"
-
-# To set any specific bootoptions for rescue images
-# present in /boot/grml just set and enable the following option:
-# CUSTOM_BOOTOPTIONS="ssh=password lang=de"
--- /dev/null
+## Configuration file for Debian package grub-loopback-iso.
+
+# Location of ISOs:
+# ISO_LOCATION="/boot/isos"
+
+# To set any specific bootoptions for loopback ISOs
+# present in /boot/isos just set and enable the following option:
+# CUSTOM_BOOTOPTIONS="ssh=password lang=de"