Accepting request 214067 from Base:System

- package autoiso.cfg and osdetect.cfg as documentation
- add 0001-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch -
  fix configure test for DejaVu font
- add dejavu-fonts to BR (needed to build starfield theme)
- package starfield theme as grub2-branding-upstream
- add grub2-use-DejaVuSansMono-for-starfield-theme.patch - use fixed width
  font for starfield theme
- clarify that grub2 subpackage contains only user space tools (forwarded request 214019 from arvidjaar)

OBS-URL: https://build.opensuse.org/request/show/214067
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=80
This commit is contained in:
Stephan Kulow 2014-01-17 10:03:50 +00:00 committed by Git OBS Bridge
parent c4bfec4a4c
commit 7a86cdab79
6 changed files with 341 additions and 1 deletions

View File

@ -0,0 +1,26 @@
From 2b1fbf23b49586e414d3212544395e18b1c0b9cb Mon Sep 17 00:00:00 2001
From: Andrey Borzenkov <arvidjaar@gmail.com>
Date: Sun, 12 Jan 2014 16:16:26 +0400
Subject: [PATCH] look for DejaVu also in /usr/share/fonts/truetype
It is installed in this path on openSUSE.
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 7c5d080..e80c074 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1375,7 +1375,7 @@ fi
if test x"$starfield_excuse" = x; then
for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
- for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu; do
+ for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do
if test -f "$dir/DejaVuSans.$ext"; then
DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
break 2
--
1.8.4

View File

@ -0,0 +1,96 @@
From: Michael Chang <mchang@suse.com>
Subject: provide overridable root by subvol
References: fate#316522, fate#316232
Patch-Mainline: no
This patch provides a environment variable $subvol that can be used
to override path relative to absolute root by specific $subvol.
Signed-off-by: Michael Chang <mchang@suse.com>
Index: grub-2.02~beta2/util/grub.d/10_linux.in
===================================================================
--- grub-2.02~beta2.orig/util/grub.d/10_linux.in
+++ grub-2.02~beta2/util/grub.d/10_linux.in
@@ -55,7 +55,9 @@ case x"$GRUB_FS" in
xbtrfs)
rootsubvol="`make_system_path_relative_to_its_root /`"
rootsubvol="${rootsubvol#/}"
- if [ "x${rootsubvol}" != x ]; then
+ if [ "x$overridable_root_by_subvol" = "xtrue" ]; then
+ GRUB_CMDLINE_LINUX="\${rootflags} ${GRUB_CMDLINE_LINUX}"
+ elif [ "x${rootsubvol}" != x ]; then
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
fi;;
xzfs)
@@ -126,17 +128,43 @@ linux_entry ()
fi
printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
fi
+
+ if [ "x$overridable_root_by_subvol" = "xtrue" -a "x$GRUB_FS" = "xbtrfs" ]; then
+ sed "s/^/$submenu_indentation/" << EOF
+ if [ "x\$subvol" = "x" ]; then
+ bootdir="${rel_dirname}"
+ rootdir="${rootsubvol}"
+ else
+ bootdir="\${subvol}${dirname}"
+ rootdir="\${subvol}"
+ fi
+ if [ "x\${rootdir}" != "x" ]; then
+ rootflags="rootflags=subvol=\${rootdir}"
+ else
+ rootflags=""
+ fi
+EOF
+ fi
+
message="$(gettext_printf "Loading Linux %s ..." ${version})"
if [ -d /sys/firmware/efi ] && [ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then
sed "s/^/$submenu_indentation/" << EOF
echo '$message'
- linuxefi ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
+ if [ "x$overridable_root_by_subvol" = "xtrue" -a "x$GRUB_FS" = "xbtrfs" ]; then
+ echo " linuxefi \${bootdir}/${basename} root=${linux_root_device_thisversion} ro ${args}" | sed "s/^/$submenu_indentation/"
+ else
+ echo " linuxefi ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}" | sed "s/^/$submenu_indentation/"
+ fi
else
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
- linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ${args}
EOF
+ if [ "x$overridable_root_by_subvol" = "xtrue" -a "x$GRUB_FS" = "xbtrfs" ]; then
+ echo " linux \${bootdir}/${basename} root=${linux_root_device_thisversion} ${args}" | sed "s/^/$submenu_indentation/"
+ else
+ echo " linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ${args}" | sed "s/^/$submenu_indentation/"
+ fi
fi
if test -n "${initrd}" ; then
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
@@ -144,13 +172,21 @@ EOF
if [ -d /sys/firmware/efi ] && [ "x${GRUB_USE_LINUXEFI}" = "xtrue" ]; then
sed "s/^/$submenu_indentation/" << EOF
echo '$message'
- initrdefi ${rel_dirname}/${initrd}
EOF
+ if [ "x$overridable_root_by_subvol" = "xtrue" -a "x$GRUB_FS" = "xbtrfs" ]; then
+ echo " initrdefi \${bootdir}/${initrd}" | sed "s/^/$submenu_indentation/"
+ else
+ echo " initrdefi ${rel_dirname}/${initrd}" | sed "s/^/$submenu_indentation/"
+ fi
else
sed "s/^/$submenu_indentation/" << EOF
echo '$(echo "$message" | grub_quote)'
- initrd ${rel_dirname}/${initrd}
EOF
+ if [ "x$overridable_root_by_subvol" = "xtrue" -a "x$GRUB_FS" = "xbtrfs" ]; then
+ echo " initrd \${bootdir}/${initrd}" | sed "s/^/$submenu_indentation/"
+ else
+ echo " initrd ${rel_dirname}/${initrd}" | sed "s/^/$submenu_indentation/"
+ fi
fi
fi
sed "s/^/$submenu_indentation/" << EOF

View File

@ -0,0 +1,160 @@
From: Michael Chang <mchang@suse.com>
Subject: create menus for btrfs snapshot
References: fate#316522, fate#316232
Patch-Mainline: no
This patch adds a new script that will create the menus used for
booting btrfs snapshots.
Signed-off-by: Michael Chang <mchang@suse.com>
Index: grub-2.02~beta2/Makefile.util.def
===================================================================
--- grub-2.02~beta2.orig/Makefile.util.def
+++ grub-2.02~beta2/Makefile.util.def
@@ -509,6 +509,13 @@ script = {
installdir = grubconf;
};
+script = {
+ name = '80_btrfs_snapshot';
+ common = util/grub.d/80_btrfs_snapshot.in;
+ installdir = grubconf;
+ condition = COND_HOST_LINUX;
+};
+
program = {
mansection = 1;
name = grub-mkrescue;
Index: grub-2.02~beta2/util/grub-mkconfig.in
===================================================================
--- grub-2.02~beta2.orig/util/grub-mkconfig.in
+++ grub-2.02~beta2/util/grub-mkconfig.in
@@ -250,7 +250,9 @@ export GRUB_DEFAULT \
GRUB_OS_PROBER_SKIP_LIST \
GRUB_DISABLE_SUBMENU \
GRUB_CMDLINE_LINUX_RECOVERY \
- GRUB_USE_LINUXEFI
+ GRUB_USE_LINUXEFI \
+ GRUB_DISABLE_BOOTING_SNAPSHOT \
+ GRUB_DISABLE_BOOTING_SNAPSHOT_SUBMENU
if test "x${grub_cfg}" != "x"; then
rm -f "${grub_cfg}.new"
Index: grub-2.02~beta2/util/grub.d/80_btrfs_snapshot.in
===================================================================
--- /dev/null
+++ grub-2.02~beta2/util/grub.d/80_btrfs_snapshot.in
@@ -0,0 +1,111 @@
+#! /bin/sh
+set -e
+
+# grub-mkconfig helper script.
+# 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/>.
+
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+datarootdir="@datarootdir@"
+
+. "${datarootdir}/grub2/grub-mkconfig_lib"
+
+# It's pointless to proceed if not using Btrfs
+if [ "x${GRUB_FS}" != "xbtrfs" ]; then
+ exit 0
+fi
+
+# The default master/main config path looked up by core.img
+master_cfg="/boot/grub2/grub.cfg"
+
+# The config with submenu of bootable btrfs snapshots
+master_snapshot_cfg="/boot/grub2/snapshot_submenu.cfg"
+
+# The slave config path in btrfs snapshot that will be sourced by master config
+# The menu entries in slave config will have it's root overridable by specified
+# subvolume name
+slave_cfg="boot/grub2/snapshot_menuentry.cfg"
+
+# The current config which is being outputted by grub-mkconfig
+output_cfg=`readlink /proc/$PPID/fd/1 | sed s/.new$//`
+
+grub_mkconfig_dir=`dirname $0`
+grub_script_check="${bindir}/grub2-script-check"
+
+# Remove any slave config if booting snapshot gets disabled, in case it will become
+# inconsistent on further updates, note this also removes master_snapshot_cfg
+if [ "x${GRUB_DISABLE_BOOTING_SNAPSHOT}" = "xtrue" ]; then
+ rm -f "/${slave_cfg}"
+ rm -f "${master_snapshot_cfg}"
+ exit 0
+fi
+
+# Only attempt to update slave config with master
+if [ "x$output_cfg" = "x$master_cfg" ]; then
+ # Create the slave config by redirecting the standard output to it
+ # Output menu entries with overridable root
+ overridable_root_by_subvol=true ${grub_mkconfig_dir}/10_linux >"/${slave_cfg}.new"
+
+ # Check if the config is sane to use
+ if ${grub_script_check} "/${slave_cfg}.new"; then
+ mv -f "/${slave_cfg}.new" "/${slave_cfg}"
+ fi
+fi
+
+# Create the bootable snapshots submenus in master config, use the ${OS} to indicate
+# distribution that owns these snapshots.
+if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
+ OS=GNU/Linux
+else
+ OS="${GRUB_DISTRIBUTOR}"
+fi
+
+# Offer an option to allow disabling (built-in) snapshot submenu. It's possible to use
+# any other submenu with more integrated information retrieved from certain snapshot
+# utility's metadata and this option would help to get their boot menu tidy without
+# submenu with duplicated purpose.
+if [ "x${GRUB_DISABLE_BOOTING_SNAPSHOT_SUBMENU}" != "xtrue" ]; then
+ cat <<EOF
+if [ -f \${config_directory}/`basename ${master_snapshot_cfg}` ]; then
+ source \${config_directory}/`basename ${master_snapshot_cfg}`
+elif [ -z "\${config_directory}" -a -f \$prefix/`basename ${master_snapshot_cfg}` ]; then
+ source \$prefix/`basename ${master_snapshot_cfg}`;
+fi
+EOF
+fi
+
+# Still we create the file regardless GRUB_DISABLE_BOOTING_SNAPSHOT_SUBMENU, as it
+# could be source to run as a backup
+# Here we search and list snapshots created by snapper by using it's convention on
+# naming snapshots
+cat <<EOF >"${master_snapshot_cfg}"
+insmod regexp
+submenu "Bootable snapshots for ${OS}" {
+ for x in /.snapshots/*; do
+ if [ -f "\$x/snapshot/${slave_cfg}" ]; then
+ snapshot_found=true
+ submenu "\$x" "\$x" {
+ set subvol="\$2/snapshot"
+ export subvol
+ source "\${subvol}/${slave_cfg}"
+ }
+ fi
+ done
+ if [ x\$snapshot_found != xtrue ]; then
+ submenu "Not Found" {true}
+ fi
+}
+EOF

View File

@ -0,0 +1,15 @@
Index: grub-2.02~beta2/configure.ac
===================================================================
--- grub-2.02~beta2.orig/configure.ac
+++ grub-2.02~beta2/configure.ac
@@ -1376,8 +1376,8 @@ fi
if test x"$starfield_excuse" = x; then
for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/truetype/ttf-dejavu /usr/share/fonts/dejavu /usr/share/fonts/truetype; do
- if test -f "$dir/DejaVuSans.$ext"; then
- DJVU_FONT_SOURCE="$dir/DejaVuSans.$ext"
+ if test -f "$dir/DejaVuSansMono.$ext"; then
+ DJVU_FONT_SOURCE="$dir/DejaVuSansMono.$ext"
break 2
fi
done

View File

@ -1,3 +1,22 @@
-------------------------------------------------------------------
Wed Jan 15 15:46:31 UTC 2014 - arvidjaar@gmail.com
- package autoiso.cfg and osdetect.cfg as documentation
- add 0001-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch -
fix configure test for DejaVu font
- add dejavu-fonts to BR (needed to build starfield theme)
- package starfield theme as grub2-branding-upstream
- add grub2-use-DejaVuSansMono-for-starfield-theme.patch - use fixed width
font for starfield theme
- clarify that grub2 subpackage contains only user space tools
-------------------------------------------------------------------
Wed Jan 15 06:18:10 UTC 2014 - mchang@suse.com
- add new patches for booting btrfs snapshot (fate#316522) (fate#316232)
* 0001-script-provide-overridable-root-by-subvol.patch
* 0002-script-create-menus-for-btrfs-snapshot.patch
-------------------------------------------------------------------
Fri Dec 27 16:36:40 UTC 2013 - arvidjaar@gmail.com

View File

@ -1,7 +1,7 @@
#
# spec file for package grub2
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -29,6 +29,7 @@ BuildRequires: glibc-devel
%endif
BuildRequires: automake
BuildRequires: bison
BuildRequires: dejavu-fonts
BuildRequires: device-mapper-devel
BuildRequires: fdupes
BuildRequires: flex
@ -125,10 +126,14 @@ Patch24: grub2-secureboot-provide-linuxefi-config.patch
Patch29: grub2-secureboot-chainloader.patch
Patch34: grub2-secureboot-use-linuxefi-on-uefi-in-os-prober.patch
Patch35: grub2-linguas.sh-no-rsync.patch
Patch36: 0001-look-for-DejaVu-also-in-usr-share-fonts-truetype.patch
Patch37: grub2-use-DejaVuSansMono-for-starfield-theme.patch
# Btrfs snapshot booting related patches
Patch101: 0002-btrfs-add-ability-to-boot-from-subvolumes.patch
Patch102: 0003-cmdline-add-envvar-loader_cmdline_append.patch
Patch103: 0004-btrfs-export-subvolume-envvars.patch
Patch110: 0001-script-provide-overridable-root-by-subvol.patch
Patch111: 0002-script-create-menus-for-btrfs-snapshot.patch
Requires: gettext-runtime
%if 0%{?suse_version} >= 1140
Requires: os-prober
@ -153,6 +158,7 @@ highly configurable and customizable bootloader with modular
architecture. It support rich scale of kernel formats, file systems,
computer architectures and hardware devices.
This package includes user space utlities to manage GRUB on your system.
Authors:
@ -165,6 +171,15 @@ Authors:
Robert Millan
Carles Pina
%package branding-upstream
Summary: Upstream branding for GRUB2's graphical console
Group: System/Fhs
Requires: %{name} = %{version}-%{release}
%description branding-upstream
Upstream branding for GRUB2's graphical console
%package %{grubarch}
Summary: Bootloader with support for Linux, Multiboot and more
@ -240,9 +255,13 @@ mv po/grub.pot po/%{name}.pot
%patch29 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%patch37 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch110 -p1
%patch111 -p1
# Generate po/LINGUAS for message catalogs ...
./linguas.sh
@ -546,6 +565,7 @@ fi
%doc COPYING NEWS README
%doc THANKS TODO ChangeLog
%doc README.openSUSE
%doc docs/autoiso.cfg docs/osdetect.cfg
%dir /boot/%{name}
%ghost /boot/%{name}/grub.cfg
%{_sysconfdir}/bash_completion.d/grub
@ -583,6 +603,7 @@ fi
%{_bindir}/%{name}-syslinux2cfg
%dir %{_libdir}/%{name}
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/themes
%if 0%{?suse_version} >= 1140
%{_datadir}/%{name}/*.pf2
%endif
@ -617,6 +638,9 @@ fi
%{_mandir}/man8/%{name}-set-default.8.*
%{_mandir}/man8/%{name}-sparc64-setup.8.*
%files branding-upstream
%{_datadir}/%{name}/themes/starfield
%if ! 0%{?only_efi:1}
%files %{grubarch}