83 lines
2.9 KiB
Diff
83 lines
2.9 KiB
Diff
|
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 <lkundrak@v3.sk>
|
||
|
|
||
|
diff -Nurp grub2.orig/conf/common.rmk grub2/conf/common.rmk
|
||
|
--- grub2.orig/conf/common.rmk 2008-08-07 21:37:16.000000000 +0200
|
||
|
+++ grub2/conf/common.rmk 2008-08-08 07:14:01.000000000 +0200
|
||
|
@@ -123,6 +123,12 @@ CLEANFILES += update-grub_lib
|
||
|
update-grub_SCRIPTS = 00_header 10_linux 10_hurd 10_windows 30_os-prober 40_custom
|
||
|
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 -Nurp grub2.orig/util/grub.d/90_persistent.in grub2/util/grub.d/90_persistent.in
|
||
|
--- grub2.orig/util/grub.d/90_persistent.in 1970-01-01 01:00:00.000000000 +0100
|
||
|
+++ grub2/util/grub.d/90_persistent.in 2008-08-08 07:14:01.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 <http://www.gnu.org/licenses/>.
|
||
|
+
|
||
|
+# 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 -Nurp grub2.orig/util/update-grub.in grub2/util/update-grub.in
|
||
|
--- grub2.orig/util/update-grub.in 2008-08-08 07:13:41.000000000 +0200
|
||
|
+++ grub2/util/update-grub.in 2008-08-08 07:14:01.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
|