Skip to content

Commit

Permalink
Add new GRUB_SUBMENU functionality and config parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
iskunk committed Apr 8, 2023
1 parent 8c499f1 commit 2772778
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
15 changes: 13 additions & 2 deletions 42_grml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ for file in "${ISO_LOCATION}"/*.iso ; do
fi
done

indent=' '
submenu_indent=
if [ -n "${GRUB_SUBMENU}" ] && [ -n "${iso_list}" ] ; then
echo "submenu \"${GRUB_SUBMENU}\" \$menuentry_id_option \"grml-rescueboot\" {"
submenu_indent="${indent}"
fi

for grmliso in $iso_list ; do
rel_dirname="$(dirname $(make_system_path_relative_to_its_root $grmliso))"
grml="$(basename $grmliso)"
Expand All @@ -112,9 +119,9 @@ for grmliso in $iso_list ; do

echo "Found Grml ISO image: $grmliso" >&2
title="Grml Rescue System ($grml)"
grub_prep=$(prepare_grub_to_access_device "$device" | sed -e "s/^/ /")
grub_prep=$(prepare_grub_to_access_device "${device}" | sed -e "s/^/${indent}/")

cat << EOF
sed -e "s/^/${submenu_indent}/" << EOF
menuentry "${title}" {
${grub_prep}
iso_path="${rel_dirname%/}/${grml}"
Expand All @@ -130,4 +137,8 @@ ${grub_prep}
EOF
done

if [ -n "${GRUB_SUBMENU}" ] && [ -n "${iso_list}" ] ; then
echo "} # end submenu \"${GRUB_SUBMENU}\""
fi

## END OF FILE #################################################################
4 changes: 4 additions & 0 deletions etc/default/grml-rescueboot
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
# Location of ISOs:
# ISO_LOCATION="/boot/grml/"

# To place the rescue boot entries into a GRUB submenu,
# set this to the desired menu name:
# GRUB_SUBMENU='Grml Rescue Boot menu'

# 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'

0 comments on commit 2772778

Please sign in to comment.