From c86b76eb78f211d8d7fd22a7a436ebcefcc5b81d8b9fe854fd116a2b7f1637e9 Mon Sep 17 00:00:00 2001 From: Stephan Kulow Date: Thu, 18 Jun 2015 04:36:52 +0000 Subject: [PATCH] Accepting request 312085 from Base:System 1 OBS-URL: https://build.opensuse.org/request/show/312085 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=119 --- ...fi-efi.c-Ensure-that-the-result-star.patch | 75 +++++++++++++++++++ grub2-snapper-plugin.sh | 22 +++++- grub2.changes | 14 ++++ grub2.spec | 2 + 4 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch diff --git a/0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch b/0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch new file mode 100644 index 0000000..c2909d3 --- /dev/null +++ b/0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch @@ -0,0 +1,75 @@ +From 7e7293d745ef7c0a13d8cbf12f474843edfdd0ab Mon Sep 17 00:00:00 2001 +From: Vladimir Serbinenko +Date: Sat, 18 Jan 2014 16:41:47 +0100 +Subject: [PATCH] * grub-core/kern/efi/efi.c: Ensure that the result + starts with / and has no //. + +--- + ChangeLog | 5 +++++ + grub-core/kern/efi/efi.c | 25 +++++++++++++++++-------- + 2 files changed, 22 insertions(+), 8 deletions(-) + +diff --git a/grub-core/kern/efi/efi.c b/grub-core/kern/efi/efi.c +index b253141..b9eb1ab 100644 +--- a/grub-core/kern/efi/efi.c ++++ b/grub-core/kern/efi/efi.c +@@ -309,7 +309,7 @@ grub_efi_modules_addr (void) + char * + grub_efi_get_filename (grub_efi_device_path_t *dp0) + { +- char *name = 0, *p; ++ char *name = 0, *p, *pi; + grub_size_t filesize = 0; + grub_efi_device_path_t *dp; + +@@ -328,7 +328,7 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) + grub_efi_uint16_t len; + len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4) + / sizeof (grub_efi_char16_t)); +- filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 1; ++ filesize += GRUB_MAX_UTF8_PER_UTF16 * len + 2; + } + + dp = GRUB_EFI_NEXT_DEVICE_PATH (dp); +@@ -356,12 +356,12 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) + grub_efi_file_path_device_path_t *fp; + grub_efi_uint16_t len; + +- if (p != name) +- *p++ = '/'; ++ *p++ = '/'; + + len = ((GRUB_EFI_DEVICE_PATH_LENGTH (dp) - 4) + / sizeof (grub_efi_char16_t)); + fp = (grub_efi_file_path_device_path_t *) dp; ++ + p = (char *) grub_utf16_to_utf8 ((unsigned char *) p, fp->path_name, len); + } + +@@ -370,10 +370,19 @@ grub_efi_get_filename (grub_efi_device_path_t *dp0) + + *p = '\0'; + +- /* EFI breaks paths with backslashes. */ +- for (p = name; *p; p++) +- if (*p == '\\') +- *p = '/'; ++ for (pi = name, p = name; *pi;) ++ { ++ /* EFI breaks paths with backslashes. */ ++ if (*pi == '\\' || *pi == '/') ++ { ++ *p++ = '/'; ++ while (*pi == '\\' || *pi == '/') ++ pi++; ++ continue; ++ } ++ *p++ = *pi++; ++ } ++ *p = '\0'; + + return name; + } +-- +2.1.4 + diff --git a/grub2-snapper-plugin.sh b/grub2-snapper-plugin.sh index 1c46327..1f371ad 100644 --- a/grub2-snapper-plugin.sh +++ b/grub2-snapper-plugin.sh @@ -62,12 +62,28 @@ snapshot_submenu () { kernel_ver=`readlink ${snapshot}/boot/image | sed -e 's/^image-//' -e 's/-default$//'` fi eval `cat ${snapshot}/etc/os-release` + + # FATE#318101 + # Show user defined comments in grub2 menu for snapshots + # Use userdata tag "bootloader=[user defined text]" + desc=`xmllint --xpath "/snapshot/userdata[key='bootloader']/value/text()" "${s_dir}/info.xml" 2>/dev/null || echo ""` + test -z "$desc" && desc=`xmllint --xpath '/snapshot/description/text()' "${s_dir}/info.xml" 2>/dev/null || echo ""` + + # FATE#317972 + # If we have a post entry and the description field is empty, + # we should use the "Pre" number and add that description to the post entry. + if test -z "$desc" -a "$stype" = "post"; then + pre_num=`xmllint --xpath '/snapshot/pre_num/text()' "${s_dir}/info.xml" 2>/dev/null || echo ""` + if test -n "$pre_num"; then + if test -f "${snapper_snapshot_path}/${pre_num}/info.xml" ; then + desc=`xmllint --xpath '/snapshot/description/text()' "${snapper_snapshot_path}/${pre_num}/info.xml" 2>/dev/null || echo ""` + fi + fi + fi + test "$important" = "yes" && important="*" || important=" " test "$stype" = "single" && stype="" - test -z "$stype" || stype=",$stype" - desc=`xmllint --xpath '/snapshot/description/text()' "${s_dir}/info.xml" 2>/dev/null || echo ""` - #test "$desc" = "timeline" && return 1 test -z "$desc" || desc=",$desc" title="${important}${NAME} $VERSION ($kernel_ver,$date$stype$desc)" diff --git a/grub2.changes b/grub2.changes index 9a04dad..e560aa4 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Fri Jun 12 07:20:00 UTC 2015 - mchang@suse.com + +- If we have a post entry and the description field is empty, we should use the + "Pre" number and add that description to the post entry. (fate#317972) +- Show user defined comments in grub2 menu for snapshots (fate#318101) + * modified grub2-snapper-plugin.sh + +------------------------------------------------------------------- +Sun Jun 7 04:00:56 UTC 2015 - arvidjaar@gmail.com + +- add 0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch + make sure firmware path starts with '/' (boo#902982) + ------------------------------------------------------------------- Fri Jun 5 03:46:33 UTC 2015 - mchang@suse.com diff --git a/grub2.spec b/grub2.spec index 746892e..53d6e8a 100644 --- a/grub2.spec +++ b/grub2.spec @@ -151,6 +151,7 @@ Source1000: PATCH_POLICY Patch1: rename-grub-info-file-to-grub2.patch Patch2: grub2-linux.patch Patch3: use-grub2-as-a-package-name.patch +Patch4: 0001-grub-core-kern-efi-efi.c-Ensure-that-the-result-star.patch Patch6: grub2-iterate-and-hook-for-extended-partition.patch Patch8: grub2-ppc-terminfo.patch Patch9: grub2-GRUB_CMDLINE_LINUX_RECOVERY-for-recovery-mode.patch @@ -397,6 +398,7 @@ mv docs/grub.texi docs/grub2.texi mv po/grub.pot po/%{name}.pot %patch2 -p1 %patch3 -p1 +%patch4 -p1 %patch6 -p1 %patch8 -p1 %patch9 -p1