|
|
a85e8e |
From c299f8584bb1084916ac794a9ebed8324ae4bb10 Mon Sep 17 00:00:00 2001
|
|
|
a85e8e |
From: Peter Jones <pjones@redhat.com>
|
|
|
a85e8e |
Date: Thu, 23 Jun 2016 11:01:39 -0400
|
|
|
a85e8e |
Subject: [PATCH 202/260] Add grub-get-kernel-settings and use it in 10_linux
|
|
|
a85e8e |
|
|
|
a85e8e |
This patch adds grub-get-kernel-settings, which reads the system kernel
|
|
|
a85e8e |
installation configuration from /etc/sysconfig/kernel, and outputs
|
|
|
a85e8e |
${GRUB_...} variables suitable for evaluation by grub-mkconfig. Those
|
|
|
a85e8e |
variables are then used by 10_linux to choose whether or not to create
|
|
|
a85e8e |
debug stanzas.
|
|
|
a85e8e |
|
|
|
a85e8e |
Resolves: rhbz#1226325
|
|
|
a85e8e |
---
|
|
|
a85e8e |
.gitignore | 1 +
|
|
|
a85e8e |
Makefile.util.def | 7 ++
|
|
|
a85e8e |
configure.ac | 2 +
|
|
|
a85e8e |
util/bash-completion.d/grub-completion.bash.in | 22 +++++++
|
|
|
a85e8e |
util/grub-get-kernel-settings.3 | 20 ++++++
|
|
|
a85e8e |
util/grub-get-kernel-settings.in | 91 ++++++++++++++++++++++++++
|
|
|
a85e8e |
util/grub-mkconfig.in | 3 +
|
|
|
a85e8e |
util/grub.d/10_linux.in | 23 +++++--
|
|
|
a85e8e |
8 files changed, 164 insertions(+), 5 deletions(-)
|
|
|
a85e8e |
create mode 100644 util/grub-get-kernel-settings.3
|
|
|
a85e8e |
create mode 100644 util/grub-get-kernel-settings.in
|
|
|
a85e8e |
|
|
|
a85e8e |
diff --git a/.gitignore b/.gitignore
|
|
|
a85e8e |
index e49f76b11..547ef0bcf 100644
|
|
|
a85e8e |
--- a/.gitignore
|
|
|
a85e8e |
+++ b/.gitignore
|
|
|
a85e8e |
@@ -61,6 +61,7 @@ grub-fstest.exe
|
|
|
a85e8e |
grub_fstest_init.c
|
|
|
a85e8e |
grub_fstest_init.h
|
|
|
a85e8e |
grub_func_test
|
|
|
a85e8e |
+grub-get-kernel-settings
|
|
|
a85e8e |
grub-install
|
|
|
a85e8e |
grub-install.exe
|
|
|
a85e8e |
grub-kbdcomp
|
|
|
a85e8e |
diff --git a/Makefile.util.def b/Makefile.util.def
|
|
|
a85e8e |
index e2821a2f3..3918e3b52 100644
|
|
|
a85e8e |
--- a/Makefile.util.def
|
|
|
a85e8e |
+++ b/Makefile.util.def
|
|
|
a85e8e |
@@ -705,6 +705,13 @@ script = {
|
|
|
a85e8e |
};
|
|
|
a85e8e |
|
|
|
a85e8e |
script = {
|
|
|
a85e8e |
+ name = grub-get-kernel-settings;
|
|
|
a85e8e |
+ common = util/grub-get-kernel-settings.in;
|
|
|
a85e8e |
+ mansection = 3;
|
|
|
a85e8e |
+ installdir = sbin;
|
|
|
a85e8e |
+};
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+script = {
|
|
|
a85e8e |
name = grub-set-default;
|
|
|
a85e8e |
common = util/grub-set-default.in;
|
|
|
a85e8e |
mansection = 8;
|
|
|
a85e8e |
diff --git a/configure.ac b/configure.ac
|
|
|
a85e8e |
index 04c052dc6..8b10a93cb 100644
|
|
|
a85e8e |
--- a/configure.ac
|
|
|
a85e8e |
+++ b/configure.ac
|
|
|
a85e8e |
@@ -58,6 +58,7 @@ grub_TRANSFORM([grub-install])
|
|
|
a85e8e |
grub_TRANSFORM([grub-mkconfig])
|
|
|
a85e8e |
grub_TRANSFORM([grub-mkfont])
|
|
|
a85e8e |
grub_TRANSFORM([grub-mkimage])
|
|
|
a85e8e |
+grub_TRANSFORM([grub-get-kernel-settings])
|
|
|
a85e8e |
grub_TRANSFORM([grub-glue-efi])
|
|
|
a85e8e |
grub_TRANSFORM([grub-mklayout])
|
|
|
a85e8e |
grub_TRANSFORM([grub-mkpasswd-pbkdf2])
|
|
|
a85e8e |
@@ -75,6 +76,7 @@ grub_TRANSFORM([grub-file])
|
|
|
a85e8e |
grub_TRANSFORM([grub-bios-setup.3])
|
|
|
a85e8e |
grub_TRANSFORM([grub-editenv.1])
|
|
|
a85e8e |
grub_TRANSFORM([grub-fstest.3])
|
|
|
a85e8e |
+grub_TRANSFORM([grub-get-kernel-settings.3])
|
|
|
a85e8e |
grub_TRANSFORM([grub-glue-efi.3])
|
|
|
a85e8e |
grub_TRANSFORM([grub-install.1])
|
|
|
a85e8e |
grub_TRANSFORM([grub-kbdcomp.3])
|
|
|
a85e8e |
diff --git a/util/bash-completion.d/grub-completion.bash.in b/util/bash-completion.d/grub-completion.bash.in
|
|
|
a85e8e |
index 44bf135b9..5c4acd496 100644
|
|
|
a85e8e |
--- a/util/bash-completion.d/grub-completion.bash.in
|
|
|
a85e8e |
+++ b/util/bash-completion.d/grub-completion.bash.in
|
|
|
a85e8e |
@@ -265,6 +265,28 @@ unset __grub_sparc64_setup_program
|
|
|
a85e8e |
|
|
|
a85e8e |
|
|
|
a85e8e |
#
|
|
|
a85e8e |
+# grub-get-kernel-settings
|
|
|
a85e8e |
+#
|
|
|
a85e8e |
+_grub_get_kernel_settings () {
|
|
|
a85e8e |
+ local cur
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ COMPREPLY=()
|
|
|
a85e8e |
+ cur=`_get_cword`
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ if [[ "$cur" == -* ]]; then
|
|
|
a85e8e |
+ __grubcomp "$(__grub_get_options_from_help)"
|
|
|
a85e8e |
+ else
|
|
|
a85e8e |
+ # Default complete with a filename
|
|
|
a85e8e |
+ _filedir
|
|
|
a85e8e |
+ fi
|
|
|
a85e8e |
+}
|
|
|
a85e8e |
+__grub_get_kernel_settings_program="@grub_get_kernel_settings@"
|
|
|
a85e8e |
+have ${__grub_get_kernel_settings_program} && \
|
|
|
a85e8e |
+ complete -F _grub_get_kernel_settings -o filenames ${__grub_get_kernel_settings_program}
|
|
|
a85e8e |
+unset __grub_get_kernel_settings_program
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+#
|
|
|
a85e8e |
# grub-install
|
|
|
a85e8e |
#
|
|
|
a85e8e |
_grub_install () {
|
|
|
a85e8e |
diff --git a/util/grub-get-kernel-settings.3 b/util/grub-get-kernel-settings.3
|
|
|
a85e8e |
new file mode 100644
|
|
|
a85e8e |
index 000000000..ba33330e2
|
|
|
a85e8e |
--- /dev/null
|
|
|
a85e8e |
+++ b/util/grub-get-kernel-settings.3
|
|
|
a85e8e |
@@ -0,0 +1,20 @@
|
|
|
a85e8e |
+.TH GRUB-GET-KERNEL-SETTINGS 3 "Thu Jun 25 2015"
|
|
|
a85e8e |
+.SH NAME
|
|
|
a85e8e |
+\fBgrub-get-kernel-settings\fR \(em Evaluate the system's kernel installation settings for use while making a grub configuration file.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+.SH SYNOPSIS
|
|
|
a85e8e |
+\fBgrub-get-kernel-settings\fR [OPTION]
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+.SH DESCRIPTION
|
|
|
a85e8e |
+\fBgrub-get-kernel-settings\fR reads the kernel installation settings on the host system, and emits a set of grub settings suitable for use when creating a grub configuration file.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+.SH OPTIONS
|
|
|
a85e8e |
+.TP
|
|
|
a85e8e |
+-h, --help
|
|
|
a85e8e |
+Display program usage and exit.
|
|
|
a85e8e |
+.TP
|
|
|
a85e8e |
+-v, --version
|
|
|
a85e8e |
+Display the current version.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+.SH SEE ALSO
|
|
|
a85e8e |
+.BR "info grub"
|
|
|
a85e8e |
diff --git a/util/grub-get-kernel-settings.in b/util/grub-get-kernel-settings.in
|
|
|
a85e8e |
new file mode 100644
|
|
|
a85e8e |
index 000000000..ae0b4696d
|
|
|
a85e8e |
--- /dev/null
|
|
|
a85e8e |
+++ b/util/grub-get-kernel-settings.in
|
|
|
a85e8e |
@@ -0,0 +1,91 @@
|
|
|
a85e8e |
+#!/bin/sh
|
|
|
a85e8e |
+set -e
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# Evaluate new-kernel-pkg's configuration file.
|
|
|
a85e8e |
+# Copyright (C) 2016 Free Software Foundation, Inc.
|
|
|
a85e8e |
+#
|
|
|
a85e8e |
+# GRUB is free software: you can redistribute it and/or modify
|
|
|
a85e8e |
+# it under the terms of the GNU General Public License as published by
|
|
|
a85e8e |
+# the Free Software Foundation, either version 3 of the License, or
|
|
|
a85e8e |
+# (at your option) any later version.
|
|
|
a85e8e |
+#
|
|
|
a85e8e |
+# GRUB is distributed in the hope that it will be useful,
|
|
|
a85e8e |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
a85e8e |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
a85e8e |
+# GNU General Public License for more details.
|
|
|
a85e8e |
+#
|
|
|
a85e8e |
+# You should have received a copy of the GNU General Public License
|
|
|
a85e8e |
+# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+prefix="@prefix@"
|
|
|
a85e8e |
+exec_prefix="@exec_prefix@"
|
|
|
a85e8e |
+datarootdir="@datarootdir@"
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+prefix="@prefix@"
|
|
|
a85e8e |
+exec_prefix="@exec_prefix@"
|
|
|
a85e8e |
+sbindir="@sbindir@"
|
|
|
a85e8e |
+bindir="@bindir@"
|
|
|
a85e8e |
+sysconfdir="@sysconfdir@"
|
|
|
a85e8e |
+PACKAGE_NAME=@PACKAGE_NAME@
|
|
|
a85e8e |
+PACKAGE_VERSION=@PACKAGE_VERSION@
|
|
|
a85e8e |
+host_os=@host_os@
|
|
|
a85e8e |
+datadir="@datadir@"
|
|
|
a85e8e |
+if [ "x$pkgdatadir" = x ]; then
|
|
|
a85e8e |
+ pkgdatadir="${datadir}/@PACKAGE@"
|
|
|
a85e8e |
+fi
|
|
|
a85e8e |
+grub_cfg=""
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+self=`basename $0`
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+grub_probe="${sbindir}/@grub_probe@"
|
|
|
a85e8e |
+grub_file="${bindir}/@grub_file@"
|
|
|
a85e8e |
+grub_editenv="${bindir}/@grub_editenv@"
|
|
|
a85e8e |
+grub_script_check="${bindir}/@grub_script_check@"
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+export TEXTDOMAIN=@PACKAGE@
|
|
|
a85e8e |
+export TEXTDOMAINDIR="@localedir@"
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+. "${pkgdatadir}/grub-mkconfig_lib"
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# Usage: usage
|
|
|
a85e8e |
+# Print the usage.
|
|
|
a85e8e |
+usage () {
|
|
|
a85e8e |
+ gettext_printf "Usage: %s [OPTION]\n" "$self"
|
|
|
a85e8e |
+ gettext "Evaluate new-kernel-pkg configuration"; echo
|
|
|
a85e8e |
+ echo
|
|
|
a85e8e |
+ print_option_help "-h, --help" "$(gettext "print this message and exit")"
|
|
|
a85e8e |
+ print_option_help "-v, --version" "$(gettext "print the version information and exit")"
|
|
|
a85e8e |
+ echo
|
|
|
a85e8e |
+}
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+# Check the arguments.
|
|
|
a85e8e |
+while test $# -gt 0
|
|
|
a85e8e |
+do
|
|
|
a85e8e |
+ option=$1
|
|
|
a85e8e |
+ shift
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ case "$option" in
|
|
|
a85e8e |
+ -h | --help)
|
|
|
a85e8e |
+ usage
|
|
|
a85e8e |
+ exit 0 ;;
|
|
|
a85e8e |
+ -v | --version)
|
|
|
a85e8e |
+ echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
|
|
a85e8e |
+ exit 0 ;;
|
|
|
a85e8e |
+ -*)
|
|
|
a85e8e |
+ gettext_printf "Unrecognized option \`%s'\n" "$option" 1>&2
|
|
|
a85e8e |
+ usage
|
|
|
a85e8e |
+ exit 1
|
|
|
a85e8e |
+ ;;
|
|
|
a85e8e |
+ # Explicitly ignore non-option arguments, for compatibility.
|
|
|
a85e8e |
+ esac
|
|
|
a85e8e |
+done
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+if test -f /etc/sysconfig/kernel ; then
|
|
|
a85e8e |
+ . /etc/sysconfig/kernel
|
|
|
a85e8e |
+fi
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+if [ "$MAKEDEBUG" = "yes" ]; then
|
|
|
a85e8e |
+ echo GRUB_LINUX_MAKE_DEBUG=true
|
|
|
a85e8e |
+ echo GRUB_CMDLINE_LINUX_DEBUG=\"systemd.log_level=debug systemd.log_target=kmsg\"
|
|
|
a85e8e |
+ echo GRUB_LINUX_DEBUG_TITLE_POSTFIX=\" with debugging\"
|
|
|
a85e8e |
+fi
|
|
|
a85e8e |
diff --git a/util/grub-mkconfig.in b/util/grub-mkconfig.in
|
|
|
a85e8e |
index 0cfe60475..aa4fdb8a3 100644
|
|
|
a85e8e |
--- a/util/grub-mkconfig.in
|
|
|
a85e8e |
+++ b/util/grub-mkconfig.in
|
|
|
a85e8e |
@@ -42,6 +42,7 @@ grub_probe="${sbindir}/@grub_probe@"
|
|
|
a85e8e |
grub_file="${bindir}/@grub_file@"
|
|
|
a85e8e |
grub_editenv="${bindir}/@grub_editenv@"
|
|
|
a85e8e |
grub_script_check="${bindir}/@grub_script_check@"
|
|
|
a85e8e |
+grub_get_kernel_settings="${sbindir}/@grub_get_kernel_settings@"
|
|
|
a85e8e |
|
|
|
a85e8e |
export TEXTDOMAIN=@PACKAGE@
|
|
|
a85e8e |
export TEXTDOMAINDIR="@localedir@"
|
|
|
a85e8e |
@@ -148,6 +149,8 @@ if test -f ${sysconfdir}/default/grub ; then
|
|
|
a85e8e |
. ${sysconfdir}/default/grub
|
|
|
a85e8e |
fi
|
|
|
a85e8e |
|
|
|
a85e8e |
+eval `${grub_get_kernel_settings}` || true
|
|
|
a85e8e |
+
|
|
|
a85e8e |
if [ "x$GRUB_DISABLE_UUID" != "xtrue" -a -z "$GRUB_DEVICE_UUID" ]; then
|
|
|
a85e8e |
GRUB_DEVICE_UUID="$GRUB_DEVICE_UUID_GENERATED"
|
|
|
a85e8e |
fi
|
|
|
a85e8e |
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
|
|
a85e8e |
index b3c460cb2..0d0086d3b 100644
|
|
|
a85e8e |
--- a/util/grub.d/10_linux.in
|
|
|
a85e8e |
+++ b/util/grub.d/10_linux.in
|
|
|
a85e8e |
@@ -99,7 +99,8 @@ linux_entry ()
|
|
|
a85e8e |
os="$1"
|
|
|
a85e8e |
version="$2"
|
|
|
a85e8e |
type="$3"
|
|
|
a85e8e |
- args="$4"
|
|
|
a85e8e |
+ isdebug="$4"
|
|
|
a85e8e |
+ args="$5"
|
|
|
a85e8e |
|
|
|
a85e8e |
sixteenbit=""
|
|
|
a85e8e |
linuxefi="linux"
|
|
|
a85e8e |
@@ -130,6 +131,9 @@ linux_entry ()
|
|
|
a85e8e |
else
|
|
|
a85e8e |
echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
|
|
|
a85e8e |
fi
|
|
|
a85e8e |
+ if [ x$isdebug = xdebug ]; then
|
|
|
a85e8e |
+ title="$title${GRUB_LINUX_DEBUG_TITLE_POSTFIX}"
|
|
|
a85e8e |
+ fi
|
|
|
a85e8e |
if [ x$type != xrecovery ] ; then
|
|
|
a85e8e |
save_default_entry | grub_add_tab
|
|
|
a85e8e |
fi
|
|
|
a85e8e |
@@ -281,11 +285,15 @@ while [ "x$list" != "x" ] ; do
|
|
|
a85e8e |
fi
|
|
|
a85e8e |
|
|
|
a85e8e |
if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xtrue ]; then
|
|
|
a85e8e |
- linux_entry "${OS}" "${version}" simple \
|
|
|
a85e8e |
+ linux_entry "${OS}" "${version}" simple standard \
|
|
|
a85e8e |
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
|
|
a85e8e |
+ if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then
|
|
|
a85e8e |
+ linux_entry "${OS}" "${version}" simple debug \
|
|
|
a85e8e |
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} ${GRUB_CMDLINE_LINUX_DEBUG}"
|
|
|
a85e8e |
+ fi
|
|
|
a85e8e |
|
|
|
a85e8e |
submenu_indentation="$grub_tab"
|
|
|
a85e8e |
-
|
|
|
a85e8e |
+
|
|
|
a85e8e |
if [ -z "$boot_device_id" ]; then
|
|
|
a85e8e |
boot_device_id="$(grub_get_device_id "${GRUB_DEVICE}")"
|
|
|
a85e8e |
fi
|
|
|
a85e8e |
@@ -294,10 +302,15 @@ while [ "x$list" != "x" ] ; do
|
|
|
a85e8e |
is_top_level=false
|
|
|
a85e8e |
fi
|
|
|
a85e8e |
|
|
|
a85e8e |
- linux_entry "${OS}" "${version}" advanced \
|
|
|
a85e8e |
+ linux_entry "${OS}" "${version}" advanced standard \
|
|
|
a85e8e |
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
|
|
|
a85e8e |
+ if [ "x$GRUB_LINUX_MAKE_DEBUG" = "xtrue" ]; then
|
|
|
a85e8e |
+ linux_entry "${OS}" "${version}" advanced debug \
|
|
|
a85e8e |
+ "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} ${GRUB_CMDLINE_LINUX_DEBUG}"
|
|
|
a85e8e |
+ fi
|
|
|
a85e8e |
+
|
|
|
a85e8e |
if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
|
|
|
a85e8e |
- linux_entry "${OS}" "${version}" recovery \
|
|
|
a85e8e |
+ linux_entry "${OS}" "${version}" recovery standard \
|
|
|
a85e8e |
"single ${GRUB_CMDLINE_LINUX}"
|
|
|
a85e8e |
fi
|
|
|
a85e8e |
|
|
|
a85e8e |
--
|
|
|
a85e8e |
2.13.0
|
|
|
a85e8e |
|