parent
56fecf0c2a
commit
6d316e0390
@ -1,4 +1,4 @@
|
||||
SOURCES/gnulib-fixes.tar.gz
|
||||
SOURCES/gnulib-9f48fb992a3d7e96610c4ce8be969cff2d61a01b.tar.gz
|
||||
SOURCES/grub-2.06.tar.xz
|
||||
SOURCES/theme.tar.bz2
|
||||
SOURCES/unifont-13.0.06.pcf.gz
|
||||
|
@ -1,4 +1,4 @@
|
||||
1a07692dfaa916675a92b1383885141f490f98d2 SOURCES/gnulib-fixes.tar.gz
|
||||
d08376d97163f99ce0d61fce160d6f7667c5c944 SOURCES/gnulib-9f48fb992a3d7e96610c4ce8be969cff2d61a01b.tar.gz
|
||||
c9f93f1e195ec7a5a21d36a13b469788c0b29f0f SOURCES/grub-2.06.tar.xz
|
||||
cf0b7763c528902da7e8b05cfa248f20c8825ce5 SOURCES/theme.tar.bz2
|
||||
3b39cb0830367171760ec536cab805abdbe08bc5 SOURCES/unifont-13.0.06.pcf.gz
|
||||
|
@ -1,176 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Wed, 15 May 2013 13:30:20 -0400
|
||||
Subject: [PATCH] Don't write messages to the screen
|
||||
|
||||
Writing messages to the screen before the menus or boot splash
|
||||
happens so quickly it looks like something is wrong and isn't
|
||||
very appealing.
|
||||
---
|
||||
grub-core/gettext/gettext.c | 25 +++++--------------------
|
||||
grub-core/kern/main.c | 5 -----
|
||||
grub-core/boot/i386/pc/boot.S | 3 ---
|
||||
grub-core/boot/i386/pc/diskboot.S | 5 -----
|
||||
util/grub.d/10_linux.in | 7 -------
|
||||
5 files changed, 5 insertions(+), 40 deletions(-)
|
||||
|
||||
diff --git a/grub-core/gettext/gettext.c b/grub-core/gettext/gettext.c
|
||||
index 4d02e62c109..84d520cd494 100644
|
||||
--- a/grub-core/gettext/gettext.c
|
||||
+++ b/grub-core/gettext/gettext.c
|
||||
@@ -434,16 +434,12 @@ static char *
|
||||
grub_gettext_env_write_lang (struct grub_env_var *var
|
||||
__attribute__ ((unused)), const char *val)
|
||||
{
|
||||
- grub_err_t err;
|
||||
+ grub_err_t __attribute__((__unused__)) err;
|
||||
err = grub_gettext_init_ext (&main_context, val, grub_env_get ("locale_dir"),
|
||||
grub_env_get ("prefix"));
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
|
||||
err = grub_gettext_init_ext (&secondary_context, val,
|
||||
grub_env_get ("secondary_locale_dir"), 0);
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
|
||||
return grub_strdup (val);
|
||||
}
|
||||
@@ -451,23 +447,19 @@ grub_gettext_env_write_lang (struct grub_env_var *var
|
||||
void
|
||||
grub_gettext_reread_prefix (const char *val)
|
||||
{
|
||||
- grub_err_t err;
|
||||
+ grub_err_t __attribute__((__unused__)) err;
|
||||
err = grub_gettext_init_ext (&main_context, grub_env_get ("lang"),
|
||||
grub_env_get ("locale_dir"),
|
||||
val);
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
}
|
||||
|
||||
static char *
|
||||
read_main (struct grub_env_var *var
|
||||
__attribute__ ((unused)), const char *val)
|
||||
{
|
||||
- grub_err_t err;
|
||||
+ grub_err_t __attribute__((__unused__)) err;
|
||||
err = grub_gettext_init_ext (&main_context, grub_env_get ("lang"), val,
|
||||
grub_env_get ("prefix"));
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
return grub_strdup (val);
|
||||
}
|
||||
|
||||
@@ -475,12 +467,9 @@ static char *
|
||||
read_secondary (struct grub_env_var *var
|
||||
__attribute__ ((unused)), const char *val)
|
||||
{
|
||||
- grub_err_t err;
|
||||
+ grub_err_t __attribute__((__unused__)) err;
|
||||
err = grub_gettext_init_ext (&secondary_context, grub_env_get ("lang"), val,
|
||||
0);
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
-
|
||||
return grub_strdup (val);
|
||||
}
|
||||
|
||||
@@ -500,18 +489,14 @@ grub_cmd_translate (grub_command_t cmd __attribute__ ((unused)),
|
||||
GRUB_MOD_INIT (gettext)
|
||||
{
|
||||
const char *lang;
|
||||
- grub_err_t err;
|
||||
+ grub_err_t __attribute__((__unused__)) err;
|
||||
|
||||
lang = grub_env_get ("lang");
|
||||
|
||||
err = grub_gettext_init_ext (&main_context, lang, grub_env_get ("locale_dir"),
|
||||
grub_env_get ("prefix"));
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
err = grub_gettext_init_ext (&secondary_context, lang,
|
||||
grub_env_get ("secondary_locale_dir"), 0);
|
||||
- if (err)
|
||||
- grub_print_error ();
|
||||
|
||||
grub_register_variable_hook ("locale_dir", NULL, read_main);
|
||||
grub_register_variable_hook ("secondary_locale_dir", NULL, read_secondary);
|
||||
diff --git a/grub-core/kern/main.c b/grub-core/kern/main.c
|
||||
index d1de9fa6873..48058d983ce 100644
|
||||
--- a/grub-core/kern/main.c
|
||||
+++ b/grub-core/kern/main.c
|
||||
@@ -269,11 +269,6 @@ grub_main (void)
|
||||
|
||||
grub_boot_time ("After machine init.");
|
||||
|
||||
- /* Hello. */
|
||||
- grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
|
||||
- grub_printf ("Welcome to GRUB!\n\n");
|
||||
- grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
||||
-
|
||||
/* Init verifiers API. */
|
||||
grub_verifiers_init ();
|
||||
|
||||
diff --git a/grub-core/boot/i386/pc/boot.S b/grub-core/boot/i386/pc/boot.S
|
||||
index 2bd0b2d2866..ea167fe1206 100644
|
||||
--- a/grub-core/boot/i386/pc/boot.S
|
||||
+++ b/grub-core/boot/i386/pc/boot.S
|
||||
@@ -249,9 +249,6 @@ real_start:
|
||||
/* save drive reference first thing! */
|
||||
pushw %dx
|
||||
|
||||
- /* print a notification message on the screen */
|
||||
- MSG(notification_string)
|
||||
-
|
||||
/* set %si to the disk address packet */
|
||||
movw $disk_address_packet, %si
|
||||
|
||||
diff --git a/grub-core/boot/i386/pc/diskboot.S b/grub-core/boot/i386/pc/diskboot.S
|
||||
index c1addc0df29..68d31de0c4c 100644
|
||||
--- a/grub-core/boot/i386/pc/diskboot.S
|
||||
+++ b/grub-core/boot/i386/pc/diskboot.S
|
||||
@@ -50,11 +50,6 @@ _start:
|
||||
/* save drive reference first thing! */
|
||||
pushw %dx
|
||||
|
||||
- /* print a notification message on the screen */
|
||||
- pushw %si
|
||||
- MSG(notification_string)
|
||||
- popw %si
|
||||
-
|
||||
/* this sets up for the first run through "bootloop" */
|
||||
movw $LOCAL(firstlist), %di
|
||||
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index dc75a1c30bf..ad2ac4b078d 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -138,27 +138,20 @@ linux_entry ()
|
||||
fi
|
||||
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
|
||||
fi
|
||||
- message="$(gettext_printf "Loading Linux %s ..." ${version})"
|
||||
sed "s/^/$submenu_indentation/" << EOF
|
||||
- echo '$(echo "$message" | grub_quote)'
|
||||
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
|
||||
EOF
|
||||
if test -n "${initrd}" ; then
|
||||
- # TRANSLATORS: ramdisk isn't identifier. Should be translated.
|
||||
- message="$(gettext_printf "Loading initial ramdisk ...")"
|
||||
initrd_path=
|
||||
for i in ${initrd}; do
|
||||
initrd_path="${initrd_path} ${rel_dirname}/${i}"
|
||||
done
|
||||
sed "s/^/$submenu_indentation/" << EOF
|
||||
- echo '$(echo "$message" | grub_quote)'
|
||||
initrd $(echo $initrd_path)
|
||||
EOF
|
||||
fi
|
||||
if test -n "${fdt}" ; then
|
||||
- message="$(gettext_printf "Loading fdt ...")"
|
||||
sed "s/^/$submenu_indentation/" << EOF
|
||||
- echo '$(echo "$message" | grub_quote)'
|
||||
devicetree ${rel_dirname}/${fdt}
|
||||
EOF
|
||||
fi
|
@ -1,42 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Wed, 15 May 2013 13:53:48 -0400
|
||||
Subject: [PATCH] Don't print GNU GRUB header
|
||||
|
||||
No one cares.
|
||||
---
|
||||
grub-core/normal/main.c | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index 7ca2e5400b1..5d5f7b539f5 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -208,15 +208,16 @@ read_config_file (const char *config)
|
||||
/* Initialize the screen. */
|
||||
void
|
||||
grub_normal_init_page (struct grub_term_output *term,
|
||||
- int y)
|
||||
+ int y __attribute__((__unused__)))
|
||||
{
|
||||
+ grub_term_cls (term);
|
||||
+
|
||||
+#if 0
|
||||
grub_ssize_t msg_len;
|
||||
int posx;
|
||||
char *msg_formatted;
|
||||
grub_uint32_t *unicode_msg;
|
||||
grub_uint32_t *last_position;
|
||||
-
|
||||
- grub_term_cls (term);
|
||||
|
||||
msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION);
|
||||
if (!msg_formatted)
|
||||
@@ -241,6 +242,7 @@ grub_normal_init_page (struct grub_term_output *term,
|
||||
grub_putcode ('\n', term);
|
||||
grub_putcode ('\n', term);
|
||||
grub_free (unicode_msg);
|
||||
+#endif
|
||||
}
|
||||
|
||||
static void
|
@ -0,0 +1,85 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 14 Mar 2011 14:27:42 -0400
|
||||
Subject: [PATCH] Don't say "GNU/Linux" in generated menus.
|
||||
|
||||
[rharwood: say it even less]
|
||||
---
|
||||
grub-core/normal/main.c | 2 +-
|
||||
tests/util/grub-shell-tester.in | 2 +-
|
||||
tests/util/grub-shell.in | 2 +-
|
||||
util/grub.d/10_linux.in | 4 ++--
|
||||
util/grub.d/20_linux_xen.in | 4 ++--
|
||||
5 files changed, 7 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index 7ca2e5400b..98372217ad 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -218,7 +218,7 @@ grub_normal_init_page (struct grub_term_output *term,
|
||||
|
||||
grub_term_cls (term);
|
||||
|
||||
- msg_formatted = grub_xasprintf (_("GNU GRUB version %s"), PACKAGE_VERSION);
|
||||
+ msg_formatted = grub_xasprintf (_("GRUB version %s"), PACKAGE_VERSION);
|
||||
if (!msg_formatted)
|
||||
return;
|
||||
|
||||
diff --git a/tests/util/grub-shell-tester.in b/tests/util/grub-shell-tester.in
|
||||
index 8a87109b15..9a4319d4f4 100644
|
||||
--- a/tests/util/grub-shell-tester.in
|
||||
+++ b/tests/util/grub-shell-tester.in
|
||||
@@ -56,7 +56,7 @@ for option in "$@"; do
|
||||
usage
|
||||
exit 0 ;;
|
||||
-v | --version)
|
||||
- echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
|
||||
+ echo "$0 (GRUB ${PACKAGE_VERSION})"
|
||||
exit 0 ;;
|
||||
--modules=*)
|
||||
ms=`echo "$option" | sed -e 's/--modules=//'`
|
||||
diff --git a/tests/util/grub-shell.in b/tests/util/grub-shell.in
|
||||
index 93e9f51484..ec1182bf93 100644
|
||||
--- a/tests/util/grub-shell.in
|
||||
+++ b/tests/util/grub-shell.in
|
||||
@@ -209,7 +209,7 @@ for option in "$@"; do
|
||||
usage
|
||||
exit 0 ;;
|
||||
-v | --version)
|
||||
- echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
|
||||
+ echo "$0 (GRUB ${PACKAGE_VERSION})"
|
||||
exit 0 ;;
|
||||
--trim)
|
||||
trim=1
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index dc75a1c30b..4a499c53a6 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
|
||||
CLASS="--class gnu-linux --class gnu --class os"
|
||||
|
||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||||
- OS=GNU/Linux
|
||||
+ OS="$(sed 's, release .*$,,g' /etc/system-release)"
|
||||
else
|
||||
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
||||
+ OS="${GRUB_DISTRIBUTOR}"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
|
||||
fi
|
||||
|
||||
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
|
||||
index 3b1f470492..ada20775a1 100644
|
||||
--- a/util/grub.d/20_linux_xen.in
|
||||
+++ b/util/grub.d/20_linux_xen.in
|
||||
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
|
||||
CLASS="--class gnu-linux --class gnu --class os --class xen"
|
||||
|
||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||||
- OS=GNU/Linux
|
||||
+ OS="$(sed 's, release .*$,,g' /etc/system-release)"
|
||||
else
|
||||
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
||||
+ OS="${GRUB_DISTRIBUTOR}"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
|
||||
fi
|
||||
|
@ -1,23 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Wed, 15 May 2013 17:49:45 -0400
|
||||
Subject: [PATCH] Don't add '*' to highlighted row
|
||||
|
||||
It is already highlighted.
|
||||
---
|
||||
grub-core/normal/menu_text.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index 18240e76cea..65deafda531 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -242,7 +242,7 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
|
||||
unicode_title[i] = ' ';
|
||||
|
||||
if (data->geo.num_entries > 1)
|
||||
- grub_putcode (highlight ? '*' : ' ', data->term);
|
||||
+ grub_putcode (' ', data->term);
|
||||
|
||||
grub_print_ucs4_menu (unicode_title,
|
||||
unicode_title + len,
|
@ -1,68 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Fri, 7 Jun 2013 11:09:04 -0400
|
||||
Subject: [PATCH] Message string cleanups
|
||||
|
||||
Make use of terminology consistent. Remove jargon.
|
||||
---
|
||||
grub-core/normal/menu_text.c | 21 +++++++++------------
|
||||
1 file changed, 9 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index 65deafda531..cc5837ed2b8 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -157,9 +157,8 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
|
||||
|
||||
if (edit)
|
||||
{
|
||||
- ret += grub_print_message_indented_real (_("Minimum Emacs-like screen editing is \
|
||||
-supported. TAB lists completions. Press Ctrl-x or F10 to boot, Ctrl-c or F2 for a \
|
||||
-command-line or ESC to discard edits and return to the GRUB menu."),
|
||||
+ ret += grub_print_message_indented_real (_("Press Ctrl-x or F10 to start, Ctrl-c or F2 for a \
|
||||
+command prompt or Escape to discard edits and return to the menu. Pressing Tab lists possible completions."),
|
||||
STANDARD_MARGIN, STANDARD_MARGIN,
|
||||
term, dry_run);
|
||||
}
|
||||
@@ -167,8 +166,8 @@ command-line or ESC to discard edits and return to the GRUB menu."),
|
||||
{
|
||||
char *msg_translated;
|
||||
|
||||
- msg_translated = grub_xasprintf (_("Use the %C and %C keys to select which "
|
||||
- "entry is highlighted."),
|
||||
+ msg_translated = grub_xasprintf (_("Use the %C and %C keys to change the "
|
||||
+ "selection."),
|
||||
GRUB_UNICODE_UPARROW,
|
||||
GRUB_UNICODE_DOWNARROW);
|
||||
if (!msg_translated)
|
||||
@@ -181,17 +180,15 @@ command-line or ESC to discard edits and return to the GRUB menu."),
|
||||
if (nested)
|
||||
{
|
||||
ret += grub_print_message_indented_real
|
||||
- (_("Press enter to boot the selected OS, "
|
||||
- "`e' to edit the commands before booting "
|
||||
- "or `c' for a command-line. ESC to return previous menu."),
|
||||
+ (_("Press 'e' to edit the selected item, "
|
||||
+ "or 'c' for a command prompt. Press Escape to return to the previous menu."),
|
||||
STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
|
||||
}
|
||||
else
|
||||
{
|
||||
ret += grub_print_message_indented_real
|
||||
- (_("Press enter to boot the selected OS, "
|
||||
- "`e' to edit the commands before booting "
|
||||
- "or `c' for a command-line."),
|
||||
+ (_("Press 'e' to edit the selected item, "
|
||||
+ "or 'c' for a command prompt."),
|
||||
STANDARD_MARGIN, STANDARD_MARGIN, term, dry_run);
|
||||
}
|
||||
}
|
||||
@@ -443,7 +440,7 @@ menu_text_print_timeout (int timeout, void *dataptr)
|
||||
|| data->timeout_msg == TIMEOUT_TERSE_NO_MARGIN)
|
||||
msg_translated = grub_xasprintf (_("%ds"), timeout);
|
||||
else
|
||||
- msg_translated = grub_xasprintf (_("The highlighted entry will be executed automatically in %ds."), timeout);
|
||||
+ msg_translated = grub_xasprintf (_("The selected entry will be started automatically in %ds."), timeout);
|
||||
if (!msg_translated)
|
||||
{
|
||||
grub_print_error ();
|
@ -1,29 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Fri, 7 Jun 2013 14:08:23 -0400
|
||||
Subject: [PATCH] Fix border spacing now that we aren't displaying it
|
||||
|
||||
---
|
||||
grub-core/normal/menu_text.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index cc5837ed2b8..b49835a9af7 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -331,12 +331,12 @@ grub_menu_init_page (int nested, int edit,
|
||||
int empty_lines = 1;
|
||||
int version_msg = 1;
|
||||
|
||||
- geo->border = 1;
|
||||
- geo->first_entry_x = 1 /* margin */ + 1 /* border */;
|
||||
+ geo->border = 0;
|
||||
+ geo->first_entry_x = 0 /* margin */ + 0 /* border */;
|
||||
geo->entry_width = grub_term_width (term) - 5;
|
||||
|
||||
geo->first_entry_y = 2 /* two empty lines*/
|
||||
- + 1 /* GNU GRUB version text */ + 1 /* top border */;
|
||||
+ + 0 /* GNU GRUB version text */ + 1 /* top border */;
|
||||
|
||||
geo->timeout_lines = 2;
|
||||
|
@ -1,25 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Fri, 7 Jun 2013 14:08:49 -0400
|
||||
Subject: [PATCH] Use the correct indentation for the term help text
|
||||
|
||||
That is consistent with the menu help text
|
||||
---
|
||||
grub-core/normal/main.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
|
||||
index 5d5f7b539f5..ec1cd257397 100644
|
||||
--- a/grub-core/normal/main.c
|
||||
+++ b/grub-core/normal/main.c
|
||||
@@ -440,8 +440,8 @@ grub_normal_reader_init (int nested)
|
||||
grub_normal_init_page (term, 1);
|
||||
grub_term_setcursor (term, 1);
|
||||
|
||||
- if (grub_term_width (term) > 3 + STANDARD_MARGIN + 20)
|
||||
- grub_print_message_indented (msg_formatted, 3, STANDARD_MARGIN, term);
|
||||
+ if (grub_term_width (term) > 2 * STANDARD_MARGIN + 20)
|
||||
+ grub_print_message_indented (msg_formatted, STANDARD_MARGIN, STANDARD_MARGIN, term);
|
||||
else
|
||||
grub_print_message_indented (msg_formatted, 0, 0, term);
|
||||
grub_putcode ('\n', term);
|
@ -1,23 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Fri, 7 Jun 2013 14:30:55 -0400
|
||||
Subject: [PATCH] Indent menu entries
|
||||
|
||||
---
|
||||
grub-core/normal/menu_text.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index b49835a9af7..6a57376fa80 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -239,7 +239,8 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
|
||||
unicode_title[i] = ' ';
|
||||
|
||||
if (data->geo.num_entries > 1)
|
||||
- grub_putcode (' ', data->term);
|
||||
+ for (i = 0; i < STANDARD_MARGIN; i++)
|
||||
+ grub_putcode (' ', data->term);
|
||||
|
||||
grub_print_ucs4_menu (unicode_title,
|
||||
unicode_title + len,
|
@ -1,34 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Fri, 7 Jun 2013 14:59:36 -0400
|
||||
Subject: [PATCH] Fix margins
|
||||
|
||||
---
|
||||
grub-core/normal/menu_text.c | 8 +++-----
|
||||
1 file changed, 3 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index 6a57376fa80..cbd62f714cb 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -333,17 +333,15 @@ grub_menu_init_page (int nested, int edit,
|
||||
int version_msg = 1;
|
||||
|
||||
geo->border = 0;
|
||||
- geo->first_entry_x = 0 /* margin */ + 0 /* border */;
|
||||
- geo->entry_width = grub_term_width (term) - 5;
|
||||
+ geo->first_entry_x = 0; /* no margin */
|
||||
+ geo->entry_width = grub_term_width (term) - 1;
|
||||
|
||||
- geo->first_entry_y = 2 /* two empty lines*/
|
||||
- + 0 /* GNU GRUB version text */ + 1 /* top border */;
|
||||
+ geo->first_entry_y = 3; /* three empty lines*/
|
||||
|
||||
geo->timeout_lines = 2;
|
||||
|
||||
/* 3 lines for timeout message and bottom margin. 2 lines for the border. */
|
||||
geo->num_entries = grub_term_height (term) - geo->first_entry_y
|
||||
- - 1 /* bottom border */
|
||||
- 1 /* empty line before info message*/
|
||||
- geo->timeout_lines /* timeout */
|
||||
- 1 /* empty final line */;
|
@ -1,24 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Fri, 21 Jun 2013 14:44:08 -0400
|
||||
Subject: [PATCH] Use -2 instead of -1 for our right-hand margin, so
|
||||
linewrapping works (#976643).
|
||||
|
||||
Signed-off-by: Peter Jones <grub2-owner@fedoraproject.org>
|
||||
---
|
||||
grub-core/normal/menu_text.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index cbd62f714cb..26e9e82042a 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -334,7 +334,7 @@ grub_menu_init_page (int nested, int edit,
|
||||
|
||||
geo->border = 0;
|
||||
geo->first_entry_x = 0; /* no margin */
|
||||
- geo->entry_width = grub_term_width (term) - 1;
|
||||
+ geo->entry_width = grub_term_width (term) - 2;
|
||||
|
||||
geo->first_entry_y = 3; /* three empty lines*/
|
||||
|
@ -1,24 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 28 Oct 2013 10:13:27 -0400
|
||||
Subject: [PATCH] F10 doesn't work on serial, so don't tell the user to hit it
|
||||
(#987443)
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/normal/menu_text.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index 26e9e82042a..4895ffe7d1d 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -157,7 +157,7 @@ print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
|
||||
|
||||
if (edit)
|
||||
{
|
||||
- ret += grub_print_message_indented_real (_("Press Ctrl-x or F10 to start, Ctrl-c or F2 for a \
|
||||
+ ret += grub_print_message_indented_real (_("Press Ctrl-x to start, Ctrl-c for a \
|
||||
command prompt or Escape to discard edits and return to the menu. Pressing Tab lists possible completions."),
|
||||
STANDARD_MARGIN, STANDARD_MARGIN,
|
||||
term, dry_run);
|
@ -1,42 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Mon, 14 Mar 2011 14:27:42 -0400
|
||||
Subject: [PATCH] Don't say "GNU/Linux" in generated menus.
|
||||
|
||||
---
|
||||
util/grub.d/10_linux.in | 4 ++--
|
||||
util/grub.d/20_linux_xen.in | 4 ++--
|
||||
2 files changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
|
||||
index ad2ac4b078d..4fc58c83304 100644
|
||||
--- a/util/grub.d/10_linux.in
|
||||
+++ b/util/grub.d/10_linux.in
|
||||
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
|
||||
CLASS="--class gnu-linux --class gnu --class os"
|
||||
|
||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||||
- OS=GNU/Linux
|
||||
+ OS="$(sed 's, release .*$,,g' /etc/system-release)"
|
||||
else
|
||||
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
||||
+ OS="${GRUB_DISTRIBUTOR}"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
|
||||
fi
|
||||
|
||||
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
|
||||
index 3b1f4704921..ada20775a14 100644
|
||||
--- a/util/grub.d/20_linux_xen.in
|
||||
+++ b/util/grub.d/20_linux_xen.in
|
||||
@@ -29,9 +29,9 @@ export TEXTDOMAINDIR="@localedir@"
|
||||
CLASS="--class gnu-linux --class gnu --class os --class xen"
|
||||
|
||||
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
|
||||
- OS=GNU/Linux
|
||||
+ OS="$(sed 's, release .*$,,g' /etc/system-release)"
|
||||
else
|
||||
- OS="${GRUB_DISTRIBUTOR} GNU/Linux"
|
||||
+ OS="${GRUB_DISTRIBUTOR}"
|
||||
CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1|LC_ALL=C sed 's,[^[:alnum:]_],_,g') ${CLASS}"
|
||||
fi
|
||||
|
@ -1,71 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Wed, 15 May 2013 16:47:33 -0400
|
||||
Subject: [PATCH] Don't draw a border around the menu
|
||||
|
||||
It looks cleaner without it.
|
||||
---
|
||||
grub-core/normal/menu_text.c | 43 -------------------------------------------
|
||||
1 file changed, 43 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index 4895ffe7d1d..e72ed438ba3 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -108,47 +108,6 @@ grub_print_message_indented (const char *msg, int margin_left, int margin_right,
|
||||
grub_print_message_indented_real (msg, margin_left, margin_right, term, 0);
|
||||
}
|
||||
|
||||
-static void
|
||||
-draw_border (struct grub_term_output *term, const struct grub_term_screen_geometry *geo)
|
||||
-{
|
||||
- int i;
|
||||
-
|
||||
- grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
|
||||
-
|
||||
- grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1,
|
||||
- geo->first_entry_y - 1 });
|
||||
- grub_putcode (GRUB_UNICODE_CORNER_UL, term);
|
||||
- for (i = 0; i < geo->entry_width + 1; i++)
|
||||
- grub_putcode (GRUB_UNICODE_HLINE, term);
|
||||
- grub_putcode (GRUB_UNICODE_CORNER_UR, term);
|
||||
-
|
||||
- for (i = 0; i < geo->num_entries; i++)
|
||||
- {
|
||||
- grub_term_gotoxy (term, (struct grub_term_coordinate) { geo->first_entry_x - 1,
|
||||
- geo->first_entry_y + i });
|
||||
- grub_putcode (GRUB_UNICODE_VLINE, term);
|
||||
- grub_term_gotoxy (term,
|
||||
- (struct grub_term_coordinate) { geo->first_entry_x + geo->entry_width + 1,
|
||||
- geo->first_entry_y + i });
|
||||
- grub_putcode (GRUB_UNICODE_VLINE, term);
|
||||
- }
|
||||
-
|
||||
- grub_term_gotoxy (term,
|
||||
- (struct grub_term_coordinate) { geo->first_entry_x - 1,
|
||||
- geo->first_entry_y - 1 + geo->num_entries + 1 });
|
||||
- grub_putcode (GRUB_UNICODE_CORNER_LL, term);
|
||||
- for (i = 0; i < geo->entry_width + 1; i++)
|
||||
- grub_putcode (GRUB_UNICODE_HLINE, term);
|
||||
- grub_putcode (GRUB_UNICODE_CORNER_LR, term);
|
||||
-
|
||||
- grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
|
||||
-
|
||||
- grub_term_gotoxy (term,
|
||||
- (struct grub_term_coordinate) { geo->first_entry_x - 1,
|
||||
- (geo->first_entry_y - 1 + geo->num_entries
|
||||
- + GRUB_TERM_MARGIN + 1) });
|
||||
-}
|
||||
-
|
||||
static int
|
||||
print_message (int nested, int edit, struct grub_term_output *term, int dry_run)
|
||||
{
|
||||
@@ -406,8 +365,6 @@ grub_menu_init_page (int nested, int edit,
|
||||
|
||||
grub_term_normal_color = grub_color_menu_normal;
|
||||
grub_term_highlight_color = grub_color_menu_highlight;
|
||||
- if (geo->border)
|
||||
- draw_border (term, geo);
|
||||
grub_term_normal_color = old_color_normal;
|
||||
grub_term_highlight_color = old_color_highlight;
|
||||
geo->timeout_y = geo->first_entry_y + geo->num_entries
|
@ -1,40 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Jon McCann <william.jon.mccann@gmail.com>
|
||||
Date: Fri, 7 Jun 2013 10:52:32 -0400
|
||||
Subject: [PATCH] Use the standard margin for the timeout string
|
||||
|
||||
So that it aligns with the other messages
|
||||
---
|
||||
grub-core/normal/menu_text.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
||||
index e72ed438ba3..ca135624356 100644
|
||||
--- a/grub-core/normal/menu_text.c
|
||||
+++ b/grub-core/normal/menu_text.c
|
||||
@@ -372,7 +372,7 @@ grub_menu_init_page (int nested, int edit,
|
||||
if (bottom_message)
|
||||
{
|
||||
grub_term_gotoxy (term,
|
||||
- (struct grub_term_coordinate) { GRUB_TERM_MARGIN,
|
||||
+ (struct grub_term_coordinate) { STANDARD_MARGIN,
|
||||
geo->timeout_y });
|
||||
|
||||
print_message (nested, edit, term, 0);
|
||||
@@ -407,14 +407,14 @@ menu_text_print_timeout (int timeout, void *dataptr)
|
||||
if (data->timeout_msg == TIMEOUT_UNKNOWN)
|
||||
{
|
||||
data->timeout_msg = grub_print_message_indented_real (msg_translated,
|
||||
- 3, 1, data->term, 1)
|
||||
+ STANDARD_MARGIN, 1, data->term, 1)
|
||||
<= data->geo.timeout_lines ? TIMEOUT_NORMAL : TIMEOUT_TERSE;
|
||||
if (data->timeout_msg == TIMEOUT_TERSE)
|
||||
{
|
||||
grub_free (msg_translated);
|
||||
msg_translated = grub_xasprintf (_("%ds"), timeout);
|
||||
if (grub_term_width (data->term) < 10)
|
||||
- data->timeout_msg = TIMEOUT_TERSE_NO_MARGIN;
|
||||
+ data->timeout_msg = STANDARD_MARGIN;
|
||||
}
|
||||
}
|
||||
|
@ -1,49 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 18 Feb 2014 09:37:49 -0500
|
||||
Subject: [PATCH] Don't emit "Booting ..." message.
|
||||
|
||||
UI team still hates this stuff, so we're disabling it for RHEL 7.
|
||||
|
||||
Resolves: rhbz#1023142
|
||||
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
---
|
||||
grub-core/normal/menu.c | 4 +++-
|
||||
grub-core/normal/menu_entry.c | 3 ---
|
||||
2 files changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
|
||||
index d7a222e681b..37d753d8081 100644
|
||||
--- a/grub-core/normal/menu.c
|
||||
+++ b/grub-core/normal/menu.c
|
||||
@@ -838,12 +838,14 @@ run_menu (grub_menu_t menu, int nested, int *auto_boot)
|
||||
|
||||
/* Callback invoked immediately before a menu entry is executed. */
|
||||
static void
|
||||
-notify_booting (grub_menu_entry_t entry,
|
||||
+notify_booting (grub_menu_entry_t __attribute__((unused)) entry,
|
||||
void *userdata __attribute__((unused)))
|
||||
{
|
||||
+#if 0
|
||||
grub_printf (" ");
|
||||
grub_printf_ (N_("Booting `%s'"), entry->title);
|
||||
grub_printf ("\n\n");
|
||||
+#endif
|
||||
}
|
||||
|
||||
/* Callback invoked when a default menu entry executed because of a timeout
|
||||
diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c
|
||||
index 50eef918cf6..de64a367c4e 100644
|
||||
--- a/grub-core/normal/menu_entry.c
|
||||
+++ b/grub-core/normal/menu_entry.c
|
||||
@@ -1176,9 +1176,6 @@ run (struct screen *screen)
|
||||
char *dummy[1] = { NULL };
|
||||
|
||||
grub_cls ();
|
||||
- grub_printf (" ");
|
||||
- grub_printf_ (N_("Booting a command list"));
|
||||
- grub_printf ("\n\n");
|
||||
|
||||
errs_before = grub_err_printed_errors;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,458 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Robert Marshall <rmarshall@redhat.com>
|
||||
Date: Mon, 16 Mar 2015 14:14:19 -0400
|
||||
Subject: [PATCH] Use Distribution Package Sort for grub2-mkconfig (#1124074)
|
||||
|
||||
Users reported that newly installed kernels on their systems installed
|
||||
with grub-mkconfig would not appear on the grub boot list in order
|
||||
starting with the most recent. Added an option for rpm-based systems to
|
||||
use the rpm-sort library to sort kernels instead.
|
||||
|
||||
Resolves rhbz#1124074
|
||||
|
||||
Signed-off-by: Robert Marshall <rmarshall@redhat.com>
|
||||
[pjones: fix --enable-rpm-sort configure option]
|
||||
Signed-off-by: Peter Jones <pjones@redhat.com>
|
||||
[thierry.vignaud: fix build with rpm-4.16]
|
||||
Signed-off-by: Thierry Vignaud <thierry.vignaud@gmail.com>
|
||||
---
|
||||
configure.ac | 38 +++++++
|
||||
Makefile.util.def | 16 +++
|
||||
util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
util/grub-mkconfig_lib.in | 11 +-
|
||||
util/grub-rpm-sort.8 | 12 ++
|
||||
5 files changed, 357 insertions(+), 1 deletion(-)
|
||||
create mode 100644 util/grub-rpm-sort.c
|
||||
create mode 100644 util/grub-rpm-sort.8
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index bec8535af70..fdcb452581c 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -72,6 +72,7 @@ grub_TRANSFORM([grub-mkrelpath])
|
||||
grub_TRANSFORM([grub-mkrescue])
|
||||
grub_TRANSFORM([grub-probe])
|
||||
grub_TRANSFORM([grub-reboot])
|
||||
+grub_TRANSFORM([grub-rpm-sort])
|
||||
grub_TRANSFORM([grub-script-check])
|
||||
grub_TRANSFORM([grub-set-default])
|
||||
grub_TRANSFORM([grub-sparc64-setup])
|
||||
@@ -95,6 +96,7 @@ grub_TRANSFORM([grub-mkrescue.1])
|
||||
grub_TRANSFORM([grub-mkstandalone.3])
|
||||
grub_TRANSFORM([grub-ofpathname.3])
|
||||
grub_TRANSFORM([grub-probe.3])
|
||||
+grub_TRANSFORM([grub-rpm-sort.8])
|
||||
grub_TRANSFORM([grub-reboot.3])
|
||||
grub_TRANSFORM([grub-render-label.3])
|
||||
grub_TRANSFORM([grub-script-check.3])
|
||||
@@ -1860,6 +1862,42 @@ fi
|
||||
|
||||
AC_SUBST([LIBDEVMAPPER])
|
||||
|
||||
+AC_ARG_ENABLE([rpm-sort],
|
||||
+ [AS_HELP_STRING([--enable-rpm-sort],
|
||||
+ [enable native rpm sorting of kernels in grub (default=guessed)])])
|
||||
+if test x"$enable_rpm_sort" = xno ; then
|
||||
+ rpm_sort_excuse="explicitly disabled"
|
||||
+fi
|
||||
+
|
||||
+if test x"$rpm_sort_excuse" = x ; then
|
||||
+ # Check for rpmlib header.
|
||||
+ AC_CHECK_HEADER([rpm/rpmlib.h], [],
|
||||
+ [rpm_sort_excuse="need rpm/rpmlib header"])
|
||||
+fi
|
||||
+
|
||||
+if test x"$rpm_sort_excuse" = x ; then
|
||||
+ # Check for rpm library.
|
||||
+ AC_CHECK_LIB([rpm], [rpmvercmp], [],
|
||||
+ [rpm_sort_excuse="rpmlib missing rpmvercmp"])
|
||||
+fi
|
||||
+
|
||||
+if test x"$rpm_sort_excuse" = x ; then
|
||||
+ LIBRPM="-lrpm";
|
||||
+ AC_DEFINE([HAVE_RPM], [1],
|
||||
+ [Define to 1 if you have the rpm library.])
|
||||
+fi
|
||||
+
|
||||
+if test x"$LIBRPM" = x ; then
|
||||
+ # Check for rpm library.
|
||||
+ AC_CHECK_LIB([rpmio], [rpmvercmp], [],
|
||||
+ [rpm_sort_excuse="rpmio missing rpmvercmp"])
|
||||
+ LIBRPM="-lrpmio";
|
||||
+ AC_DEFINE([HAVE_RPMIO], [1],
|
||||
+ [Define to 1 if you have the rpm library.])
|
||||
+fi
|
||||
+
|
||||
+AC_SUBST([LIBRPM])
|
||||
+
|
||||
LIBGEOM=
|
||||
if test x$host_kernel = xkfreebsd; then
|
||||
AC_CHECK_LIB([geom], [geom_gettree], [],
|
||||
diff --git a/Makefile.util.def b/Makefile.util.def
|
||||
index 2c9b283a230..ba4cf4b29b0 100644
|
||||
--- a/Makefile.util.def
|
||||
+++ b/Makefile.util.def
|
||||
@@ -703,6 +703,22 @@ program = {
|
||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||
};
|
||||
|
||||
+program = {
|
||||
+ name = grub-rpm-sort;
|
||||
+ mansection = 8;
|
||||
+ installdir = sbin;
|
||||
+
|
||||
+ common = grub-core/kern/emu/misc.c;
|
||||
+ common = grub-core/kern/emu/argp_common.c;
|
||||
+ common = grub-core/osdep/init.c;
|
||||
+ common = util/misc.c;
|
||||
+ common = util/grub-rpm-sort.c;
|
||||
+
|
||||
+ ldadd = libgrubkern.a;
|
||||
+ ldadd = grub-core/lib/gnulib/libgnu.a;
|
||||
+ ldadd = '$(LIBDEVMAPPER) $(LIBRPM)';
|
||||
+};
|
||||
+
|
||||
script = {
|
||||
name = grub-mkconfig;
|
||||
common = util/grub-mkconfig.in;
|
||||
diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c
|
||||
new file mode 100644
|
||||
index 00000000000..f33bd1ed568
|
||||
--- /dev/null
|
||||
+++ b/util/grub-rpm-sort.c
|
||||
@@ -0,0 +1,281 @@
|
||||
+#include <config.h>
|
||||
+#include <grub/types.h>
|
||||
+#include <grub/util/misc.h>
|
||||
+#include <stdio.h>
|
||||
+#include <stdlib.h>
|
||||
+#include <unistd.h>
|
||||
+#include <errno.h>
|
||||
+#include <assert.h>
|
||||
+#include <argp.h>
|
||||
+#include <rpm/rpmlib.h>
|
||||
+
|
||||
+static size_t
|
||||
+read_file (const char *input, char **ret)
|
||||
+{
|
||||
+ FILE *in;
|
||||
+ size_t s;
|
||||
+ size_t sz = 2048;
|
||||
+ size_t offset = 0;
|
||||
+ char *text;
|
||||
+
|
||||
+ if (!strcmp(input, "-"))
|
||||
+ in = stdin;
|
||||
+ else
|
||||
+ in = grub_util_fopen(input, "r");
|
||||
+
|
||||
+ text = xmalloc (sz);
|
||||
+
|
||||
+ if (!in)
|
||||
+ grub_util_error (_("cannot open `%s': %s"), input, strerror (errno));
|
||||
+
|
||||
+ while ((s = fread (text + offset, 1, sz - offset, in)) != 0)
|
||||
+ {
|
||||
+ offset += s;
|
||||
+ if (sz - offset == 0)
|
||||
+ {
|
||||
+ sz += 2048;
|
||||
+ text = xrealloc (text, sz);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ text[offset] = '\0';
|
||||
+ *ret = text;
|
||||
+
|
||||
+ if (in != stdin)
|
||||
+ fclose(in);
|
||||
+
|
||||
+ return offset + 1;
|
||||
+}
|
||||
+
|
||||
+/* returns name/version/release */
|
||||
+/* NULL string pointer returned if nothing found */
|
||||
+static void
|
||||
+split_package_string (char *package_string, char **name,
|
||||
+ char **version, char **release)
|
||||
+{
|
||||
+ char *package_version, *package_release;
|
||||
+
|
||||
+ /* Release */
|
||||
+ package_release = strrchr (package_string, '-');
|
||||
+
|
||||
+ if (package_release != NULL)
|
||||
+ *package_release++ = '\0';
|
||||
+
|
||||
+ *release = package_release;
|
||||
+
|
||||
+ /* Version */
|
||||
+ package_version = strrchr(package_string, '-');
|
||||
+
|
||||
+ if (package_version != NULL)
|
||||
+ *package_version++ = '\0';
|
||||
+
|
||||
+ *version = package_version;
|
||||
+ /* Name */
|
||||
+ *name = package_string;
|
||||
+
|
||||
+ /* Bubble up non-null values from release to name */
|
||||
+ if (*name == NULL)
|
||||
+ {
|
||||
+ *name = (*version == NULL ? *release : *version);
|
||||
+ *version = *release;
|
||||
+ *release = NULL;
|
||||
+ }
|
||||
+ if (*version == NULL)
|
||||
+ {
|
||||
+ *version = *release;
|
||||
+ *release = NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
+ * package name-version-release comparator for qsort
|
||||
+ * expects p, q which are pointers to character strings (char *)
|
||||
+ * which will not be altered in this function
|
||||
+ */
|
||||
+static int
|
||||
+package_version_compare (const void *p, const void *q)
|
||||
+{
|
||||
+ char *local_p, *local_q;
|
||||
+ char *lhs_name, *lhs_version, *lhs_release;
|
||||
+ char *rhs_name, *rhs_version, *rhs_release;
|
||||
+ int vercmpflag = 0;
|
||||
+
|
||||
+ local_p = alloca (strlen (*(char * const *)p) + 1);
|
||||
+ local_q = alloca (strlen (*(char * const *)q) + 1);
|
||||
+
|
||||
+ /* make sure these allocated */
|
||||
+ assert (local_p);
|
||||
+ assert (local_q);
|
||||
+
|
||||
+ strcpy (local_p, *(char * const *)p);
|
||||
+ strcpy (local_q, *(char * const *)q);
|
||||
+
|
||||
+ split_package_string (local_p, &lhs_name, &lhs_version, &lhs_release);
|
||||
+ split_package_string (local_q, &rhs_name, &rhs_version, &rhs_release);
|
||||
+
|
||||
+ /* Check Name and return if unequal */
|
||||
+ vercmpflag = rpmvercmp ((lhs_name == NULL ? "" : lhs_name),
|
||||
+ (rhs_name == NULL ? "" : rhs_name));
|
||||
+ if (vercmpflag != 0)
|
||||
+ return vercmpflag;
|
||||
+
|
||||
+ /* Check version and return if unequal */
|
||||
+ vercmpflag = rpmvercmp ((lhs_version == NULL ? "" : lhs_version),
|
||||
+ (rhs_version == NULL ? "" : rhs_version));
|
||||
+ if (vercmpflag != 0)
|
||||
+ return vercmpflag;
|
||||
+
|
||||
+ /* Check release and return the version compare value */
|
||||
+ vercmpflag = rpmvercmp ((lhs_release == NULL ? "" : lhs_release),
|
||||
+ (rhs_release == NULL ? "" : rhs_release));
|
||||
+
|
||||
+ return vercmpflag;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+add_input (const char *filename, char ***package_names, size_t *n_package_names)
|
||||
+{
|
||||
+ char *orig_input_buffer = NULL;
|
||||
+ char *input_buffer;
|
||||
+ char *position_of_newline;
|
||||
+ char **names = *package_names;
|
||||
+ char **new_names = NULL;
|
||||
+ size_t n_names = *n_package_names;
|
||||
+
|
||||
+ if (!*package_names)
|
||||
+ new_names = names = xmalloc (sizeof (char *) * 2);
|
||||
+
|
||||
+ if (read_file (filename, &orig_input_buffer) < 2)
|
||||
+ {
|
||||
+ if (new_names)
|
||||
+ free (new_names);
|
||||
+ if (orig_input_buffer)
|
||||
+ free (orig_input_buffer);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ input_buffer = orig_input_buffer;
|
||||
+ while (input_buffer && *input_buffer &&
|
||||
+ (position_of_newline = strchrnul (input_buffer, '\n')))
|
||||
+ {
|
||||
+ size_t sz = position_of_newline - input_buffer;
|
||||
+ char *new;
|
||||
+
|
||||
+ if (sz == 0)
|
||||
+ {
|
||||
+ input_buffer = position_of_newline + 1;
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ new = xmalloc (sz+1);
|
||||
+ strncpy (new, input_buffer, sz);
|
||||
+ new[sz] = '\0';
|
||||
+
|
||||
+ names = xrealloc (names, sizeof (char *) * (n_names + 1));
|
||||
+ names[n_names] = new;
|
||||
+ n_names++;
|
||||
+
|
||||
+ /* move buffer ahead to next line */
|
||||
+ input_buffer = position_of_newline + 1;
|
||||
+ if (*position_of_newline == '\0')
|
||||
+ input_buffer = NULL;
|
||||
+ }
|
||||
+
|
||||
+ free (orig_input_buffer);
|
||||
+
|
||||
+ *package_names = names;
|
||||
+ *n_package_names = n_names;
|
||||
+}
|
||||
+
|
||||
+static char *
|
||||
+help_filter (int key, const char *text, void *input __attribute__ ((unused)))
|
||||
+{
|
||||
+ return (char *)text;
|
||||
+}
|
||||
+
|
||||
+static struct argp_option options[] = {
|
||||
+ { 0, }
|
||||
+};
|
||||
+
|
||||
+struct arguments
|
||||
+{
|
||||
+ size_t ninputs;
|
||||
+ size_t input_max;
|
||||
+ char **inputs;
|
||||
+};
|
||||
+
|
||||
+static error_t
|
||||
+argp_parser (int key, char *arg, struct argp_state *state)
|
||||
+{
|
||||
+ struct arguments *arguments = state->input;
|
||||
+ switch (key)
|
||||
+ {
|
||||
+ case ARGP_KEY_ARG:
|
||||
+ assert (arguments->ninputs < arguments->input_max);
|
||||
+ arguments->inputs[arguments->ninputs++] = xstrdup (arg);
|
||||
+ break;
|
||||
+ default:
|
||||
+ return ARGP_ERR_UNKNOWN;
|
||||
+ }
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
+static struct argp argp = {
|
||||
+ options, argp_parser, N_("[INPUT_FILES]"),
|
||||
+ N_("Sort a list of strings in RPM version sort order."),
|
||||
+ NULL, help_filter, NULL
|
||||
+};
|
||||
+
|
||||
+int
|
||||
+main (int argc, char *argv[])
|
||||
+{
|
||||
+ struct arguments arguments;
|
||||
+ char **package_names = NULL;
|
||||
+ size_t n_package_names = 0;
|
||||
+ int i;
|
||||
+
|
||||
+ grub_util_host_init (&argc, &argv);
|
||||
+
|
||||
+ memset (&arguments, 0, sizeof (struct arguments));
|
||||
+ arguments.input_max = argc+1;
|
||||
+ arguments.inputs = xmalloc ((arguments.input_max + 1)
|
||||
+ * sizeof (arguments.inputs[0]));
|
||||
+ memset (arguments.inputs, 0, (arguments.input_max + 1)
|
||||
+ * sizeof (arguments.inputs[0]));
|
||||
+
|
||||
+ /* Parse our arguments */
|
||||
+ if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0)
|
||||
+ grub_util_error ("%s", _("Error in parsing command line arguments\n"));
|
||||
+
|
||||
+ /* If there's no inputs in argv, add one for stdin */
|
||||
+ if (!arguments.ninputs)
|
||||
+ {
|
||||
+ arguments.ninputs = 1;
|
||||
+ arguments.inputs[0] = xmalloc (2);
|
||||
+ strcpy(arguments.inputs[0], "-");
|
||||
+ }
|
||||
+
|
||||
+ for (i = 0; i < arguments.ninputs; i++)
|
||||
+ add_input(arguments.inputs[i], &package_names, &n_package_names);
|
||||
+
|
||||
+ if (package_names == NULL || n_package_names < 1)
|
||||
+ grub_util_error ("%s", _("Invalid input\n"));
|
||||
+
|
||||
+ qsort (package_names, n_package_names, sizeof (char *),
|
||||
+ package_version_compare);
|
||||
+
|
||||
+ /* send sorted list to stdout */
|
||||
+ for (i = 0; i < n_package_names; i++)
|
||||
+ {
|
||||
+ fprintf (stdout, "%s\n", package_names[i]);
|
||||
+ free (package_names[i]);
|
||||
+ }
|
||||
+
|
||||
+ free (package_names);
|
||||
+ for (i = 0; i < arguments.ninputs; i++)
|
||||
+ free (arguments.inputs[i]);
|
||||
+
|
||||
+ free (arguments.inputs);
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in
|
||||
index 0f6505bf3b6..42c2ea9ba50 100644
|
||||
--- a/util/grub-mkconfig_lib.in
|
||||
+++ b/util/grub-mkconfig_lib.in
|
||||
@@ -33,6 +33,9 @@ fi
|
||||
if test "x$grub_mkrelpath" = x; then
|
||||
grub_mkrelpath="${bindir}/@grub_mkrelpath@"
|
||||
fi
|
||||
+if test "x$grub_rpm_sort" = x; then
|
||||
+ grub_rpm_sort="${sbindir}/@grub_rpm_sort@"
|
||||
+fi
|
||||
|
||||
if command -v gettext >/dev/null; then
|
||||
:
|
||||
@@ -218,6 +221,12 @@ version_sort ()
|
||||
esac
|
||||
}
|
||||
|
||||
+if [ "x$grub_rpm_sort" != x -a -x "$grub_rpm_sort" ]; then
|
||||
+ kernel_sort="$grub_rpm_sort"
|
||||
+else
|
||||
+ kernel_sort=version_sort
|
||||
+fi
|
||||
+
|
||||
version_test_numeric ()
|
||||
{
|
||||
version_test_numeric_a="$1"
|
||||
@@ -234,7 +243,7 @@ version_test_numeric ()
|
||||
version_test_numeric_a="$version_test_numeric_b"
|
||||
version_test_numeric_b="$version_test_numeric_c"
|
||||
fi
|
||||
- if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | version_sort | head -n 1 | grep -qx "$version_test_numeric_b" ; then
|
||||
+ if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") | "$kernel_sort" | head -n 1 | grep -qx "$version_test_numeric_b" ; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
diff --git a/util/grub-rpm-sort.8 b/util/grub-rpm-sort.8
|
||||
new file mode 100644
|
||||
index 00000000000..8ce21488448
|
||||
--- /dev/null
|
||||
+++ b/util/grub-rpm-sort.8
|
||||
@@ -0,0 +1,12 @@
|
||||
+.TH GRUB-RPM-SORT 8 "Wed Feb 26 2014"
|
||||
+.SH NAME
|
||||
+\fBgrub-rpm-sort\fR \(em Sort input according to RPM version compare.
|
||||
+
|
||||
+.SH SYNOPSIS
|
||||
+\fBgrub-rpm-sort\fR [OPTIONS].
|
||||
+
|
||||
+.SH DESCRIPTION
|
||||
+You should not normally run this program directly. Use grub-mkconfig instead.
|
||||
+
|
||||
+.SH SEE ALSO
|
||||
+.BR "info grub"
|
@ -1,150 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Peter Jones <pjones@redhat.com>
|
||||
Date: Tue, 23 Sep 2014 09:58:49 -0400
|
||||
Subject: [PATCH] Fix up some man pages rpmdiff noticed.
|
||||
|
||||
---
|
||||
configure.ac | 2 ++
|
||||
util/grub-macbless.8 | 26 +++++++++++++++++++
|
||||
util/grub-mkimage.1 | 2 +-
|
||||
util/grub-syslinux2cfg.1 | 65 ++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
4 files changed, 94 insertions(+), 1 deletion(-)
|
||||
create mode 100644 util/grub-macbless.8
|
||||
create mode 100644 util/grub-syslinux2cfg.1
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index ed31ea457d2..537ed411469 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -87,6 +87,7 @@ grub_TRANSFORM([grub-get-kernel-settings.3])
|
||||
grub_TRANSFORM([grub-glue-efi.3])
|
||||
grub_TRANSFORM([grub-install.1])
|
||||
grub_TRANSFORM([grub-kbdcomp.3])
|
||||
+grub_TRANSFORM([grub-macbless.8])
|
||||
grub_TRANSFORM([grub-menulst2cfg.1])
|
||||
grub_TRANSFORM([grub-mkconfig.1])
|
||||
grub_TRANSFORM([grub-mkfont.3])
|
||||
@@ -105,6 +106,7 @@ grub_TRANSFORM([grub-render-label.3])
|
||||
grub_TRANSFORM([grub-script-check.3])
|
||||
grub_TRANSFORM([grub-set-default.1])
|
||||
grub_TRANSFORM([grub-sparc64-setup.3])
|
||||
+grub_TRANSFORM([grub-syslinux2cfg.1])
|
||||
|
||||
# Optimization flag. Allow user to override.
|
||||
if test "x$TARGET_CFLAGS" = x; then
|
||||
diff --git a/util/grub-macbless.8 b/util/grub-macbless.8
|
||||
new file mode 100644
|
||||
index 00000000000..ae842f3a606
|
||||
--- /dev/null
|
||||
+++ b/util/grub-macbless.8
|
||||
@@ -0,0 +1,26 @@
|
||||
+.TH GRUB-MACBLESS 1 "Wed Feb 26 2014"
|
||||
+.SH NAME
|
||||
+\fBgrub-macbless\fR \(em Mac-style bless utility for HFS or HFS+
|
||||
+
|
||||
+.SH SYNOPSIS
|
||||
+\fBgrub-macbless\fR [-p | --ppc] [-v | --verbose] [-x | --x86] \fIFILE\fR
|
||||
+
|
||||
+.SH DESCRIPTION
|
||||
+\fBgrub-mkimage\fR blesses a file on an HFS or HFS+ file system, so that it
|
||||
+can be used to boot a Mac.
|
||||
+
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+--ppc
|
||||
+Bless the file for use on PPC-based Macs.
|
||||
+
|
||||
+.TP
|
||||
+--verbose
|
||||
+Print verbose messages.
|
||||
+
|
||||
+.TP
|
||||
+--x86
|
||||
+Bless the file for use on x86-based Macs.
|
||||
+
|
||||
+.SH SEE ALSO
|
||||
+.BR "info grub"
|
||||
diff --git a/util/grub-mkimage.1 b/util/grub-mkimage.1
|
||||
index 4dea4f54597..0eaaafe505b 100644
|
||||
--- a/util/grub-mkimage.1
|
||||
+++ b/util/grub-mkimage.1
|
||||
@@ -17,7 +17,7 @@
|
||||
[-v | --verbose] \fIMODULES\fR
|
||||
|
||||
.SH DESCRIPTION
|
||||
-\fBgrub-mkimage\fI builds a bootable image of GRUB.
|
||||
+\fBgrub-mkimage\fR builds a bootable image of GRUB.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
diff --git a/util/grub-syslinux2cfg.1 b/util/grub-syslinux2cfg.1
|
||||
new file mode 100644
|
||||
index 00000000000..85309482718
|
||||
--- /dev/null
|
||||
+++ b/util/grub-syslinux2cfg.1
|
||||
@@ -0,0 +1,65 @@
|
||||
+.TH GRUB-SYSLINUX2CFG 1 "Wed Feb 26 2014"
|
||||
+.SH NAME
|
||||
+\fBgrub-syslinux2cfg\fR \(em Transform a syslinux config file into a GRUB config.
|
||||
+
|
||||
+.SH SYNOPSIS
|
||||
+\fBgrub-syslinux2cfg\fR [-c | --cwd=\fRDIR\fI] [-r | --root=\fIDIR\fR] [-v | --verbose]
|
||||
+.RE
|
||||
+.RS 25
|
||||
+[-t | --target-root=\fIDIR\fR] [-T | --target-cwd=\fIDIR\fR]
|
||||
+.RE
|
||||
+.RS 25
|
||||
+[-o | --output=\fIFILE\fR] [[-i | --isolinux] |
|
||||
+.RE
|
||||
+.RS 46
|
||||
+ [-s | --syslinux] |
|
||||
+.RE
|
||||
+.RS 46
|
||||
+ [-p | --pxelinux]] \fIFILE\fR
|
||||
+
|
||||
+.SH DESCRIPTION
|
||||
+\fBgrub-syslinux2cfg\fR builds a GRUB configuration file out of an existing
|
||||
+syslinux configuration file.
|
||||
+
|
||||
+.SH OPTIONS
|
||||
+.TP
|
||||
+--cwd=\fIDIR\fR
|
||||
+Set \fIDIR\fR as syslinux's working directory. The default is to use the
|
||||
+parent directory of the input file.
|
||||
+
|
||||
+.TP
|
||||
+--root=\fIDIR\fR
|
||||
+Set \fIDIR\fR as the root directory of the syslinux disk. The default value
|
||||
+is "/".
|
||||
+
|
||||
+.TP
|
||||
+--verbose
|
||||
+Print verbose messages.
|
||||
+
|
||||
+.TP
|
||||
+--target-root=\fIDIR\fR
|
||||
+Root directory as it will be seen at runtime. The default value is "/".
|
||||
+
|
||||
+.TP
|
||||
+--target-cwd=\fIDIR\fR
|
||||
+Working directory of syslinux as it will be seen at runtime. The default
|
||||
+value is the parent directory of the input file.
|
||||
+
|
||||
+.TP
|
||||
+--output=\fIFILE\fR
|
||||
+Write the new config file to \fIFILE\fR. The default value is standard output.
|
||||
+
|
||||
+.TP
|
||||
+--isolinux
|
||||
+Assume that the input file is an isolinux configuration file.
|
||||
+
|
||||
+.TP
|
||||
+--pxelinux
|
||||
+Assume that the input file is a pxelinux configuration file.
|
||||
+
|
||||
+.TP
|
||||
+--syslinux
|
||||
+Assume that the input file is a syslinux configuration file.
|
||||
+
|
||||
+.SH SEE ALSO
|
||||
+.BR "info grub"
|
@ -1,347 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Chang <mchang@suse.com>
|
||||
Date: Tue, 6 Feb 2018 09:09:00 +0100
|
||||
Subject: [PATCH] Add linux and initrd commands for grub-emu
|
||||
|
||||
When using grub-emu, the linux and initrd commands are used as arguments
|
||||
to the kexec command line tool, to allow booting the selected menu entry.
|
||||
---
|
||||
grub-core/Makefile.core.def | 1 -
|
||||
grub-core/kern/emu/main.c | 4 +
|
||||
grub-core/kern/emu/misc.c | 18 ++++-
|
||||
grub-core/loader/emu/linux.c | 172 +++++++++++++++++++++++++++++++++++++++++++
|
||||
include/grub/emu/exec.h | 4 +-
|
||||
include/grub/emu/hostfile.h | 3 +-
|
||||
include/grub/emu/misc.h | 3 +
|
||||
grub-core/Makefile.am | 1 +
|
||||
8 files changed, 202 insertions(+), 4 deletions(-)
|
||||
create mode 100644 grub-core/loader/emu/linux.c
|
||||
|
||||
diff --git a/grub-core/Makefile.core.def b/grub-core/Makefile.core.def
|
||||
index 058c88ac3af..5354f9613d3 100644
|
||||
--- a/grub-core/Makefile.core.def
|
||||
+++ b/grub-core/Makefile.core.def
|
||||
@@ -1826,7 +1826,6 @@ module = {
|
||||
|
||||
common = loader/linux.c;
|
||||
common = lib/cmdline.c;
|
||||
- enable = noemu;
|
||||
|
||||
efi = loader/efi/linux.c;
|
||||
};
|
||||
diff --git a/grub-core/kern/emu/main.c b/grub-core/kern/emu/main.c
|
||||
index 55ea5a11ccd..846fe9715ec 100644
|
||||
--- a/grub-core/kern/emu/main.c
|
||||
+++ b/grub-core/kern/emu/main.c
|
||||
@@ -107,6 +107,7 @@ static struct argp_option options[] = {
|
||||
N_("use GRUB files in the directory DIR [default=%s]"), 0},
|
||||
{"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
|
||||
{"hold", 'H', N_("SECS"), OPTION_ARG_OPTIONAL, N_("wait until a debugger will attach"), 0},
|
||||
+ {"kexec", 'X', 0, 0, N_("try the untryable."), 0},
|
||||
{ 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
@@ -164,6 +165,9 @@ argp_parser (int key, char *arg, struct argp_state *state)
|
||||
case 'v':
|
||||
verbosity++;
|
||||
break;
|
||||
+ case 'X':
|
||||
+ grub_util_set_kexecute();
|
||||
+ break;
|
||||
|
||||
case ARGP_KEY_ARG:
|
||||
{
|
||||
diff --git a/grub-core/kern/emu/misc.c b/grub-core/kern/emu/misc.c
|
||||
index 0ff13bcaf8c..eeea092752d 100644
|
||||
--- a/grub-core/kern/emu/misc.c
|
||||
+++ b/grub-core/kern/emu/misc.c
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <grub/emu/misc.h>
|
||||
|
||||
int verbosity;
|
||||
+int kexecute;
|
||||
|
||||
void
|
||||
grub_util_warn (const char *fmt, ...)
|
||||
@@ -82,7 +83,7 @@ grub_util_error (const char *fmt, ...)
|
||||
vfprintf (stderr, fmt, ap);
|
||||
va_end (ap);
|
||||
fprintf (stderr, ".\n");
|
||||
- exit (1);
|
||||
+ grub_exit (1);
|
||||
}
|
||||
|
||||
void *
|
||||
@@ -154,6 +155,9 @@ void
|
||||
__attribute__ ((noreturn))
|
||||
grub_exit (int rc)
|
||||
{
|
||||
+#if defined (GRUB_KERNEL)
|
||||
+ grub_reboot();
|
||||
+#endif
|
||||
exit (rc < 0 ? 1 : rc);
|
||||
}
|
||||
#endif
|
||||
@@ -215,3 +219,15 @@ grub_util_load_image (const char *path, char *buf)
|
||||
|
||||
fclose (fp);
|
||||
}
|
||||
+
|
||||
+void
|
||||
+grub_util_set_kexecute(void)
|
||||
+{
|
||||
+ kexecute++;
|
||||
+}
|
||||
+
|
||||
+int
|
||||
+grub_util_get_kexecute(void)
|
||||
+{
|
||||
+ return kexecute;
|
||||
+}
|
||||
diff --git a/grub-core/loader/emu/linux.c b/grub-core/loader/emu/linux.c
|
||||
new file mode 100644
|
||||
index 00000000000..fda9e00d24c
|
||||
--- /dev/null
|
||||
+++ b/grub-core/loader/emu/linux.c
|
||||
@@ -0,0 +1,172 @@
|
||||
+/*
|
||||
+ * GRUB -- GRand Unified Bootloader
|
||||
+ * Copyright (C) 2006,2007,2008,2009,2010 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/>.
|
||||
+ */
|
||||
+
|
||||
+#include <grub/loader.h>
|
||||
+#include <grub/dl.h>
|
||||
+#include <grub/command.h>
|
||||
+#include <grub/time.h>
|
||||
+
|
||||
+#include <grub/emu/exec.h>
|
||||
+#include <grub/emu/hostfile.h>
|
||||
+#include <grub/emu/misc.h>
|
||||
+
|
||||
+GRUB_MOD_LICENSE ("GPLv3+");
|
||||
+
|
||||
+static grub_dl_t my_mod;
|
||||
+
|
||||
+static char *kernel_path;
|
||||
+static char *initrd_path;
|
||||
+static char *boot_cmdline;
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_linux_boot (void)
|
||||
+{
|
||||
+ grub_err_t rc = GRUB_ERR_NONE;
|
||||
+ char *initrd_param;
|
||||
+ const char *kexec[] = { "kexec", "-l", kernel_path, boot_cmdline, NULL, NULL };
|
||||
+ const char *systemctl[] = { "systemctl", "kexec", NULL };
|
||||
+ int kexecute = grub_util_get_kexecute();
|
||||
+
|
||||
+ if (initrd_path) {
|
||||
+ initrd_param = grub_xasprintf("--initrd=%s", initrd_path);
|
||||
+ kexec[3] = initrd_param;
|
||||
+ kexec[4] = boot_cmdline;
|
||||
+ } else {
|
||||
+ initrd_param = grub_xasprintf("%s", "");
|
||||
+ }
|
||||
+
|
||||
+ grub_printf("%serforming 'kexec -l %s %s %s'\n",
|
||||
+ (kexecute) ? "P" : "Not p",
|
||||
+ kernel_path, initrd_param, boot_cmdline);
|
||||
+
|
||||
+ if (kexecute)
|
||||
+ rc = grub_util_exec(kexec);
|
||||
+
|
||||
+ grub_free(initrd_param);
|
||||
+
|
||||
+ if (rc != GRUB_ERR_NONE) {
|
||||
+ grub_error (rc, N_("Error trying to perform kexec load operation."));
|
||||
+ grub_sleep (3);
|
||||
+ return rc;
|
||||
+ }
|
||||
+ if (kexecute < 1)
|
||||
+ grub_fatal (N_("Use '"PACKAGE"-emu --kexec' to force a system restart."));
|
||||
+
|
||||
+ grub_printf("Performing 'systemctl kexec' (%s) ",
|
||||
+ (kexecute==1) ? "do-or-die" : "just-in-case");
|
||||
+ rc = grub_util_exec (systemctl);
|
||||
+
|
||||
+ if (kexecute == 1)
|
||||
+ grub_fatal (N_("Error trying to perform 'systemctl kexec'"));
|
||||
+
|
||||
+ /* need to check read-only root before resetting hard!? */
|
||||
+ grub_printf("Performing 'kexec -e'");
|
||||
+ kexec[1] = "-e";
|
||||
+ kexec[2] = NULL;
|
||||
+ rc = grub_util_exec(kexec);
|
||||
+ if ( rc != GRUB_ERR_NONE )
|
||||
+ grub_fatal (N_("Error trying to directly perform 'kexec -e'."));
|
||||
+
|
||||
+ return rc;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_linux_unload (void)
|
||||
+{
|
||||
+ grub_dl_unref (my_mod);
|
||||
+ if ( boot_cmdline != NULL )
|
||||
+ grub_free (boot_cmdline);
|
||||
+ boot_cmdline = NULL;
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[])
|
||||
+{
|
||||
+ int i;
|
||||
+ char *tempstr;
|
||||
+
|
||||
+ grub_dl_ref (my_mod);
|
||||
+
|
||||
+ if (argc == 0)
|
||||
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
+
|
||||
+ if ( !grub_util_is_regular(argv[0]) )
|
||||
+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, N_("Cannot find kernel file %s"), argv[0]);
|
||||
+
|
||||
+ if ( kernel_path != NULL )
|
||||
+ grub_free(kernel_path);
|
||||
+
|
||||
+ kernel_path = grub_xasprintf("%s", argv[0]);
|
||||
+
|
||||
+ if ( boot_cmdline != NULL ) {
|
||||
+ grub_free(boot_cmdline);
|
||||
+ boot_cmdline = NULL;
|
||||
+ }
|
||||
+
|
||||
+ if ( argc > 1 )
|
||||
+ {
|
||||
+ boot_cmdline = grub_xasprintf("--command-line=%s", argv[1]);
|
||||
+ for ( i = 2; i < argc; i++ ) {
|
||||
+ tempstr = grub_xasprintf("%s %s", boot_cmdline, argv[i]);
|
||||
+ grub_free(boot_cmdline);
|
||||
+ boot_cmdline = tempstr;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ grub_loader_set (grub_linux_boot, grub_linux_unload, 0);
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static grub_err_t
|
||||
+grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)), int argc, char *argv[])
|
||||
+{
|
||||
+ if (argc == 0)
|
||||
+ return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected"));
|
||||
+
|
||||
+ if ( !grub_util_is_regular(argv[0]) )
|
||||
+ return grub_error(GRUB_ERR_FILE_NOT_FOUND, N_("Cannot find initrd file %s"), argv[0]);
|
||||
+
|
||||
+ if ( initrd_path != NULL )
|
||||
+ grub_free(initrd_path);
|
||||
+
|
||||
+ initrd_path = grub_xasprintf("%s", argv[0]);
|
||||
+
|
||||
+ grub_dl_unref (my_mod);
|
||||
+
|
||||
+ return GRUB_ERR_NONE;
|
||||
+}
|
||||
+
|
||||
+static grub_command_t cmd_linux, cmd_initrd;
|
||||
+
|
||||
+GRUB_MOD_INIT(linux)
|
||||
+{
|
||||
+ cmd_linux = grub_register_command ("linux", grub_cmd_linux, 0, N_("Load Linux."));
|
||||
+ cmd_initrd = grub_register_command ("initrd", grub_cmd_initrd, 0, N_("Load initrd."));
|
||||
+ my_mod = mod;
|
||||
+ kernel_path = NULL;
|
||||
+ initrd_path = NULL;
|
||||
+ boot_cmdline = NULL;
|
||||
+}
|
||||
+
|
||||
+GRUB_MOD_FINI(linux)
|
||||
+{
|
||||
+ grub_unregister_command (cmd_linux);
|
||||
+ grub_unregister_command (cmd_initrd);
|
||||
+}
|
||||
diff --git a/include/grub/emu/exec.h b/include/grub/emu/exec.h
|
||||
index d1073ef86af..1b61b4a2e5d 100644
|
||||
--- a/include/grub/emu/exec.h
|
||||
+++ b/include/grub/emu/exec.h
|
||||
@@ -23,6 +23,8 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
+#include <grub/symbol.h>
|
||||
+
|
||||
pid_t
|
||||
grub_util_exec_pipe (const char *const *argv, int *fd);
|
||||
pid_t
|
||||
@@ -32,7 +34,7 @@ int
|
||||
grub_util_exec_redirect_all (const char *const *argv, const char *stdin_file,
|
||||
const char *stdout_file, const char *stderr_file);
|
||||
int
|
||||
-grub_util_exec (const char *const *argv);
|
||||
+EXPORT_FUNC(grub_util_exec) (const char *const *argv);
|
||||
int
|
||||
grub_util_exec_redirect (const char *const *argv, const char *stdin_file,
|
||||
const char *stdout_file);
|
||||
diff --git a/include/grub/emu/hostfile.h b/include/grub/emu/hostfile.h
|
||||
index cfb1e2b5661..a61568e36e9 100644
|
||||
--- a/include/grub/emu/hostfile.h
|
||||
+++ b/include/grub/emu/hostfile.h
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <grub/disk.h>
|
||||
#include <grub/partition.h>
|
||||
#include <sys/types.h>
|
||||
+#include <grub/symbol.h>
|
||||
#include <grub/osdep/hostfile.h>
|
||||
|
||||
int
|
||||
@@ -29,7 +30,7 @@ grub_util_is_directory (const char *path);
|
||||
int
|
||||
grub_util_is_special_file (const char *path);
|
||||
int
|
||||
-grub_util_is_regular (const char *path);
|
||||
+EXPORT_FUNC(grub_util_is_regular) (const char *path);
|
||||
|
||||
char *
|
||||
grub_util_path_concat (size_t n, ...);
|
||||
diff --git a/include/grub/emu/misc.h b/include/grub/emu/misc.h
|
||||
index ff9c48a6490..01056954b96 100644
|
||||
--- a/include/grub/emu/misc.h
|
||||
+++ b/include/grub/emu/misc.h
|
||||
@@ -57,6 +57,9 @@ void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...) __attribute__ ((format (
|
||||
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2)));
|
||||
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((format (GNU_PRINTF, 1, 2), noreturn));
|
||||
|
||||
+void EXPORT_FUNC(grub_util_set_kexecute) (void);
|
||||
+int EXPORT_FUNC(grub_util_get_kexecute) (void) WARN_UNUSED_RESULT;
|
||||
+
|
||||
grub_uint64_t EXPORT_FUNC (grub_util_get_cpu_time_ms) (void);
|
||||
|
||||
#ifdef HAVE_DEVICE_MAPPER
|
||||
diff --git a/grub-core/Makefile.am b/grub-core/Makefile.am
|
||||
index ee88e44e97a..80e7a83edf9 100644
|
||||
--- a/grub-core/Makefile.am
|
||||
+++ b/grub-core/Makefile.am
|
||||
@@ -307,6 +307,7 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostdisk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostfile.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
+KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/exec.h
|
||||
if COND_GRUB_EMU_SDL
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h
|
||||
endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue