Release new version 0.2.0.
[grml-rescueboot.git] / 42_grml
1 #!/bin/sh
2 # Filename:      42_grml
3 # Purpose:       grub-mkconfig helper script for Grml rescue systems
4 # Authors:       grml-team (grml.org), (c) Andreas Gredler <jimmy@grml.org>, Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2+.
7 ################################################################################
8
9 set -e
10
11 prefix=/usr
12 exec_prefix=${prefix}
13 bindir=${exec_prefix}/bin
14 libdir=${exec_prefix}/lib
15 . ${libdir}/grub/grub-mkconfig_lib
16
17 # default unless configured otherwise:
18 ISO_LOCATION="/boot/grml"
19
20 if [ -r /etc/default/grml-rescueboot ] ; then
21   . /etc/default/grml-rescueboot
22 fi
23
24 list=$(for i in "${ISO_LOCATION}"/*.iso ; do
25          if grub_file_is_not_garbage "$i" ; then echo -n "$i " ; fi
26        done)
27
28 for grmliso in $list ; do
29   rel_dirname="$(make_system_path_relative_to_its_root $(dirname $grmliso))"
30   grml="$(basename $grmliso)"
31
32   echo "Found Grml ISO image: $grmliso" >&2
33   title="Grml Rescue System ($grml)"
34
35   cat << EOF
36 menuentry "${title}" {
37         iso_path="${rel_dirname}/$grml $CUSTOM_BOOTOPTIONS"
38         export iso_path
39         loopback loop "${rel_dirname}/$grml"
40         set root=(loop)
41         configfile /boot/grub/loopback.cfg
42 }
43 EOF
44 done
45
46 ## END OF FILE #################################################################