diff --git a/README.debrand b/README.debrand deleted file mode 100644 index 01c46d2..0000000 --- a/README.debrand +++ /dev/null @@ -1,2 +0,0 @@ -Warning: This package was configured for automatic debranding, but the changes -failed to apply. diff --git a/SOURCES/0001-Try-to-make-sure-configure.ac-and-grub-rpm-sort-play.patch b/SOURCES/0001-Try-to-make-sure-configure.ac-and-grub-rpm-sort-play.patch new file mode 100644 index 0000000..47e99ce --- /dev/null +++ b/SOURCES/0001-Try-to-make-sure-configure.ac-and-grub-rpm-sort-play.patch @@ -0,0 +1,60 @@ +From 0576c43a727f095caac0b04b551ebdb66adf616a Mon Sep 17 00:00:00 2001 +From: Peter Jones +Date: Mon, 3 Aug 2015 11:46:42 -0400 +Subject: [PATCH] Try to make sure configure.ac and grub-rpm-sort play nice. + +Apparently the test for whether to use grub-rpm-sort and also the +renaming of it to grub2-rpm-sort on the runtime side weren't right. + +Related: rhbz#1124074 + +Signed-off-by: Peter Jones +--- + configure.ac | 2 +- + util/grub-mkconfig_lib.in | 9 ++++++--- + 2 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 273da6c..04c052d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -1549,7 +1549,7 @@ 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 ++if test x"$enable_rpm_sort" = xno ; then + rpm_sort_excuse="explicitly disabled" + fi + +diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in +index e85b60c..c67a319 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 which gettext >/dev/null 2>/dev/null; then + : +@@ -213,10 +216,10 @@ version_sort () + esac + } + +-if [ "x$RPMLIB" = x ]; then +- kernel_sort=version_sort ++if [ "x$grub_rpm_sort" != x -a -x "$grub_rpm_sort" ]; then ++ kernel_sort="$grub_rpm_sort" + else +- kernel_sort="${sbindir}/grub-rpm-sort" ++ kernel_sort=version_sort + fi + + version_test_numeric () +-- +2.4.3 + diff --git a/SOURCES/0002-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch b/SOURCES/0002-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch new file mode 100644 index 0000000..3b4aa57 --- /dev/null +++ b/SOURCES/0002-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch @@ -0,0 +1,450 @@ +From 57df7233ae3789f525b8d7e910bf1e3ffe50ac87 Mon Sep 17 00:00:00 2001 +From: Robert Marshall +Date: Mon, 16 Mar 2015 14:14:19 -0400 +Subject: [PATCH 2/2] 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 +--- + .gitignore | 1 + + Makefile.util.def | 16 +++ + configure.ac | 29 +++++ + util/grub-mkconfig_lib.in | 8 +- + util/grub-rpm-sort.8 | 12 ++ + util/grub-rpm-sort.c | 281 ++++++++++++++++++++++++++++++++++++++++++++++ + 6 files changed, 346 insertions(+), 1 deletion(-) + create mode 100644 util/grub-rpm-sort.8 + create mode 100644 util/grub-rpm-sort.c + +diff --git a/.gitignore b/.gitignore +index 18ab8e8..b6c4577 100644 +--- a/.gitignore ++++ b/.gitignore +@@ -237,6 +237,7 @@ po/POTFILES.in + po/POTFILES-shell.in + /grub-glue-efi + /grub-render-label ++grub-rpm-sort + /grub-glue-efi.exe + /grub-render-label.exe + grub-core/gnulib/locale.h +diff --git a/Makefile.util.def b/Makefile.util.def +index 87029a1..3ac7572 100644 +--- a/Makefile.util.def ++++ b/Makefile.util.def +@@ -675,6 +675,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 = grub-core/gnulib/libgnu.a; ++ ldadd = libgrubkern.a; ++ ldadd = '$(LIBDEVMAPPER) $(LIBRPM)'; ++}; ++ + script = { + name = grub-mkconfig; + common = util/grub-mkconfig.in; +diff --git a/configure.ac b/configure.ac +index 048ce7c..de17e65 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -65,6 +65,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]) +@@ -89,6 +90,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]) +@@ -1543,6 +1545,33 @@ 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 ++ ++AC_SUBST([LIBRPM]) ++ + LIBGEOM= + if test x$host_kernel = xkfreebsd; then + AC_CHECK_LIB([geom], [geom_gettree], [], +diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in +index 5c9ed84..e85b60c 100644 +--- a/util/grub-mkconfig_lib.in ++++ b/util/grub-mkconfig_lib.in +@@ -213,6 +213,12 @@ version_sort () + esac + } + ++if [ "x$RPMLIB" = x ]; then ++ kernel_sort=version_sort ++else ++ kernel_sort="${sbindir}/grub-rpm-sort" ++fi ++ + version_test_numeric () + { + version_test_numeric_a="$1" +@@ -229,7 +235,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 0000000..8ce2148 +--- /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" +diff --git a/util/grub-rpm-sort.c b/util/grub-rpm-sort.c +new file mode 100644 +index 0000000..f33bd1e +--- /dev/null ++++ b/util/grub-rpm-sort.c +@@ -0,0 +1,281 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++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; ++} +-- +2.4.3 + diff --git a/SOURCES/centos.cer b/SOURCES/centos.cer deleted file mode 100644 index 00a5580..0000000 Binary files a/SOURCES/centos.cer and /dev/null differ diff --git a/SOURCES/secureboot.cer b/SOURCES/secureboot.cer new file mode 100644 index 0000000..4ff8b79 Binary files /dev/null and b/SOURCES/secureboot.cer differ diff --git a/SOURCES/securebootca.cer b/SOURCES/securebootca.cer new file mode 100644 index 0000000..b235400 Binary files /dev/null and b/SOURCES/securebootca.cer differ diff --git a/SPECS/grub2.spec b/SPECS/grub2.spec index 6865221..f0e5eba 100644 --- a/SPECS/grub2.spec +++ b/SPECS/grub2.spec @@ -33,9 +33,6 @@ %if 0%{?fedora} %global efidir fedora %endif -%if 0%{?centos} -%global efidir centos -%endif %endif @@ -45,7 +42,7 @@ Name: grub2 Epoch: 1 Version: 2.02 -Release: 0.16%{?dist} +Release: 0.17%{?dist}.4 Summary: Bootloader with support for Linux, Multiboot and more Group: System Environment/Base @@ -54,7 +51,8 @@ URL: http://www.gnu.org/software/grub/ Obsoletes: grub < 1:0.98 Source0: ftp://alpha.gnu.org/gnu/grub/grub-%{tarversion}.tar.xz #Source0: ftp://ftp.gnu.org/gnu/grub/grub-%{tarversion}.tar.xz -Source1: centos.cer +Source1: securebootca.cer +Source2: secureboot.cer Source4: http://unifoundry.com/unifont-5.1.20080820.pcf.gz Source5: theme.tar.bz2 Source6: gitignore @@ -214,6 +212,8 @@ Patch0151: 0001-Initialized-initrd_ctx-so-we-don-t-free-a-random-poi.patch Patch0152: 0002-Load-arm-with-SB-enabled.patch Patch0153: 0001-Fix-up-some-man-pages-rpmdiff-noticed.patch Patch0154: 0001-Try-prefix-if-fw_path-doesn-t-work.patch +Patch0155: 0002-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch +Patch0156: 0001-Try-to-make-sure-configure.ac-and-grub-rpm-sort-play.patch BuildRequires: flex bison binutils python BuildRequires: ncurses-devel xz-devel bzip2-devel @@ -230,6 +230,7 @@ BuildRequires: freetype-devel gettext-devel git BuildRequires: texinfo BuildRequires: dejavu-sans-fonts BuildRequires: help2man +BuildRequires: rpm-devel %ifarch %{efiarchs} %ifnarch aarch64 BuildRequires: pesign >= 0.109-3.el7 @@ -361,8 +362,8 @@ GRUB_MODULES="${GRUB_MODULES} linuxefi multiboot2 multiboot" mv %{grubefiname}.orig %{grubefiname} mv %{grubeficdname}.orig %{grubeficdname} %else -%pesign -s -i %{grubefiname}.orig -o %{grubefiname} -a %{SOURCE1} -c %{SOURCE1} -n redhatsecureboot301 -%pesign -s -i %{grubeficdname}.orig -o %{grubeficdname} -a %{SOURCE1} -c %{SOURCE1} -n redhatsecureboot301 +%pesign -s -i %{grubefiname}.orig -o %{grubefiname} -a %{SOURCE1} -c %{SOURCE2} -n redhatsecureboot301 +%pesign -s -i %{grubeficdname}.orig -o %{grubeficdname} -a %{SOURCE1} -c %{SOURCE2} -n redhatsecureboot301 %endif cd .. %endif @@ -590,6 +591,7 @@ fi %{_sbindir}/%{name}-ofpathname %{_sbindir}/%{name}-probe %{_sbindir}/%{name}-reboot +%{_sbindir}/%{name}-rpm-sort %{_sbindir}/%{name}-set-default %{_sbindir}/%{name}-sparc64-setup %{_bindir}/%{name}-editenv @@ -636,9 +638,25 @@ fi %exclude %{_datarootdir}/grub/themes/starfield %changelog -* Thu Mar 05 2015 Johnny Hughes - 2.02-0.16.el7.centos -- Move the edidir to be CentOS, so people can co-install fedora, rhel and centos -- Roll in CentOS Secureboot keys +* Mon Aug 03 2015 Robert Marshall - 2.02-0.17.4 +- Reversed .17.2 and changed how rpm-sort availability is verified. + Resolves: rhbz#1229329 + +* Fri Jul 31 2015 Robert Marshall = 2.02.0.17.3 +- Built again with proper build target and updates rhbz# to be zstream. + Resolves: rhbz#1229329 + +* Thu Jul 30 2015 Robert Marshall - 2.02.0.17.2 +- Reversed order of kernel sorting. + Resolves: rhbz#1229329 + +* Tue Jul 14 2015 Robert Marshall - 2.02-0.17.1 +- Fixed rpmdiff issues. + Resolves: rhbz#1229329 + +* Mon Jul 13 2015 Robert Marshall - 2.02.0.17 +- Use an rpm-based version sorted in grub2-mkconfig + Resolves: rhbz#1229329 * Thu Oct 09 2014 Peter Jones - 2.02-0.16 - ... and build it on the right target.