/etc/grub.d/42_grml is in grml-rescueboot 0.4.7.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | #!/bin/sh
# Filename: 42_grml
# Purpose: grub-mkconfig helper script for Grml rescue systems
# 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+.
################################################################################
set -e
prefix=/usr
exec_prefix=${prefix}
bindir=${exec_prefix}/bin
libdir=${exec_prefix}/lib
if [ -r ${libdir}/grub/grub-mkconfig_lib ] ; then
. ${libdir}/grub/grub-mkconfig_lib
elif [ -r /usr/share/grub/grub-mkconfig_lib ] ; then # fallback for e.g. Fedora
. /usr/share/grub/grub-mkconfig_lib
else
echo "Could not locate file grub-mkconfig_lib, please report a bug." >&2
fi
# default unless configured otherwise:
ISO_LOCATION="/boot/grml"
if [ -r /etc/default/grml-rescueboot ] ; then
. /etc/default/grml-rescueboot
fi
resolve_dm_name() {
retval="$1"
base=${1##*/}
for block in /sys/block /sys/class/block ; do
[ ! -d ${block}/${base}/dm ] && continue
retval="/dev/mapper/$(cat ${block}/${base}/dm/name)"
break
done
case "$retval" in
/dev/dm-*)
minor=${retval##*-}
retval="/dev/mapper/$(dmsetup info -C --noheadings -o name -j 253 -m $minor)"
;;
esac
echo "$retval"
}
get_dependencies() {
device=${1}
if [ -z ${device} ] ; then
return
fi
device=$(readlink -f ${device})
case "$device" in
/dev/mapper/*)
device="/dev/dm-$(dmsetup info -C --noheadings -o minor "$device")"
;;
esac
base=${device##*/}
dependencies=""
additional_dependencies=""
for block in /sys/block /sys/class/block ; do
[ ! -d ${block}/${base}/slaves ] && continue
for file in ${block}/${base}/slaves/* ; do
dep_name="/dev/${file##*/}"
dep_name=$(resolve_dm_name ${dep_name})
# resolve recursively all dependencies
additional_dependencies=$(get_dependencies ${dep_name})
dependencies="$dependencies $additional_dependencies $dep_name"
done
break
done
echo $dependencies
}
iso_list=""
for file in "${ISO_LOCATION}"/*.iso ; do
if grub_file_is_not_garbage "$file" ; then
iso_list="$iso_list $file "
fi
done
for grmliso in $iso_list ; do
rel_dirname="$(dirname $(make_system_path_relative_to_its_root $grmliso))"
grml="$(basename $grmliso)"
device="$(${grub_probe} -t device ${grmliso})"
additional_param=""
case "$device" in
/dev/mapper*|/dev/md*)
dependencies=$(get_dependencies ${device})
dep_string=""
for dep in $dependencies $device ; do
dep_string="$dep_string,$dep"
done
dep_string=${dep_string#,}
additional_param="live-media=$dep_string"
;;
esac
echo "Found Grml ISO image: $grmliso" >&2
title="Grml Rescue System ($grml)"
grub_prep=$(prepare_grub_to_access_device "$device" | sed -e "s/^/ /")
cat << EOF
menuentry "${title}" {
${grub_prep}
iso_path="${rel_dirname%/}/${grml}"
export iso_path
kernelopts=" $CUSTOM_BOOTOPTIONS $additional_param "
export kernelopts
loopback loop "${rel_dirname%/}/$grml"
set root=(loop)
configfile /boot/grub/loopback.cfg
}
EOF
done
## END OF FILE #################################################################
|