This adds a section to the configuration file that persists the updates, so that it's not only grub2-update itself that decides what's in the configuration. Lubomir Rintel diff -up grub2/conf/common.rmk.persistent grub2/conf/common.rmk --- grub2/conf/common.rmk.persistent 2008-08-27 10:49:16.000000000 +0200 +++ grub2/conf/common.rmk 2008-08-27 13:51:33.000000000 +0200 @@ -138,6 +138,12 @@ endif CLEANFILES += $(update-grub_SCRIPTS) +90_persistent: util/grub.d/90_persistent.in config.status + ./config.status --file=$@:$< + chmod +x $@ +update-grub_SCRIPTS += 90_persistent +CLEANFILES += 90_persistent + update-grub_DATA += util/grub.d/README diff -up /dev/null grub2/util/grub.d/90_persistent.in --- /dev/null 2008-08-24 16:09:23.777049452 +0200 +++ grub2/util/grub.d/90_persistent.in 2008-08-27 13:51:33.000000000 +0200 @@ -0,0 +1,37 @@ +#! /bin/sh -e + +# update-grub helper script. +# Copyright (C) 2008 Free Software Foundation, Inc. +# +# GRUB is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# GRUB is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GRUB. If not, see . + +# The output of this script is copied from part of grub.cfg +# that correspond to itself. The achievement is that user can +# modify that part of grub.cfg directly, and it will be persistent +# across update-grub runs. + +transform="@program_transform_name@" + +ME=$(echo $0 |sed 's,/,\\/,g') +GRUBCFG=/boot/`echo grub | sed ${transform}`/grub.cfg + +# Exit gracefully if there's no configuration file yet +[ -f ${GRUBCFG} ] || exit 0 + +awk " + BEGIN {echo = 0} + /### BEGIN $ME ###/ {echo = 1; next} + /### END $ME ###/ {echo = 0; next} + {if (echo) print} +" ${GRUBCFG} diff -up grub2/util/update-grub.in.persistent grub2/util/update-grub.in --- grub2/util/update-grub.in.persistent 2008-08-27 13:51:33.000000000 +0200 +++ grub2/util/update-grub.in 2008-08-27 13:51:33.000000000 +0200 @@ -176,11 +176,12 @@ echo "Updating ${grub_cfg} ..." >&2 cat << EOF # -# DO NOT EDIT THIS FILE -# -# It is automatically generated by $0 using templates +# This is automatically generated by $0 using templates # from ${update_grub_dir} and settings from ${sysconfdir}/default/grub # +# If you want your changes to persist across updates, add them +# to 90_persistent section +# EOF for i in ${update_grub_dir}/* ; do