From dc5ad4ab6cd249661ccd61ebbb773eea59afcae41c6524f28574100a10bf9d29 Mon Sep 17 00:00:00 2001 From: Sascha Peilicke Date: Wed, 13 Jul 2011 13:58:47 +0000 Subject: [PATCH] Accepting request 76157 from devel:openSUSE:Factory Only run preun when deinstalling package (forwarded request 76120 from a_jaeger) OBS-URL: https://build.opensuse.org/request/show/76157 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grub2?expand=0&rev=16 --- README.openSUSE | 28 ++++++++++++++++++++++++++++ gccwarn.patch | 12 ++++++++---- grub2-linux-submenu.patch | 26 ++++++++++++++++++++++++++ grub2.changes | 12 ++++++++++++ grub2.spec | 34 ++++++++++++---------------------- 5 files changed, 86 insertions(+), 26 deletions(-) create mode 100644 grub2-linux-submenu.patch diff --git a/README.openSUSE b/README.openSUSE index d0a86cc..d1d7612 100644 --- a/README.openSUSE +++ b/README.openSUSE @@ -46,3 +46,31 @@ Support channels If you find a bug in this package, report them to the openSUSE Bugzilla [2]. [2] http://bugzilla.novell.com/ + +Installation +------------ + +There is not yet any support in openSUSE to configure and install +grub2. To install it for the first time, run (replace /dev/sdaX with +your boot partition or use /dev/sda for the MBR): + +# grub2-install --no-floppy /dev/sdaX +# grub2-mkconfig -o /boot/grub2/grub.cfg + +To just update the configuration after the kernel changes, run +# grub2-mkconfig -o /boot/grub2/grub.cfg + +For testing, you might want to pass --grub-setup=/bin/true to +grub2-install - this way, grub2 is not setup in the MBR and you can +use grub to chainload a grub2 configuration. + +In the grub menu.lst, just add (after changing the hd0,1 parameter): +title GNU GRUB 2 -- openSUSE 12.1 - GNU GRUB 2 + kernel (hd0,1)/boot/grub2/core.img + +Warning +------- +Currently, perl-Bootloader does not support grub2 as bootloader. + +Therefore you need to run the following after each kernel change: +# grub2-mkconfig -o /boot/grub2/grub.cfg diff --git a/gccwarn.patch b/gccwarn.patch index 8ff9db7..570d973 100644 --- a/gccwarn.patch +++ b/gccwarn.patch @@ -3,8 +3,10 @@ grub-core/lib/libgcrypt/cipher/camellia.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) ---- a/grub-core/lib/libgcrypt-grub/cipher/camellia.c -+++ b/grub-core/lib/libgcrypt-grub/cipher/camellia.c +Index: grub-1.99/grub-core/lib/libgcrypt-grub/cipher/camellia.c +=================================================================== +--- grub-1.99.orig/grub-core/lib/libgcrypt-grub/cipher/camellia.c ++++ grub-1.99/grub-core/lib/libgcrypt-grub/cipher/camellia.c @@ -29,9 +29,8 @@ GRUB_MOD_LICENSE ("GPLv3+"); @@ -16,8 +18,10 @@ typedef unsigned char u8; /* key constants */ ---- a/grub-core/lib/libgcrypt/cipher/camellia.c -+++ b/grub-core/lib/libgcrypt/cipher/camellia.c +Index: grub-1.99/grub-core/lib/libgcrypt/cipher/camellia.c +=================================================================== +--- grub-1.99.orig/grub-core/lib/libgcrypt/cipher/camellia.c ++++ grub-1.99/grub-core/lib/libgcrypt/cipher/camellia.c @@ -26,10 +26,9 @@ #include #include diff --git a/grub2-linux-submenu.patch b/grub2-linux-submenu.patch new file mode 100644 index 0000000..18e1988 --- /dev/null +++ b/grub2-linux-submenu.patch @@ -0,0 +1,26 @@ +Index: grub-1.99/util/grub.d/10_linux.in +=================================================================== +--- grub-1.99.orig/util/grub.d/10_linux.in ++++ grub-1.99/util/grub.d/10_linux.in +@@ -144,6 +144,7 @@ esac + prepare_boot_cache= + prepare_root_cache= + ++in_submenu=false + while [ "x$list" != "x" ] ; do + linux=`version_find_latest $list` + echo "Found linux image: $linux" >&2 +@@ -196,4 +197,13 @@ while [ "x$list" != "x" ] ; do + fi + + list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '` ++ ++ if [ "$list" ] && ! $in_submenu; then ++ echo "submenu \"Previous Linux versions\" {" ++ in_submenu=: ++ fi + done ++ ++if $in_submenu; then ++ echo "}" ++fi diff --git a/grub2.changes b/grub2.changes index 4080737..d54c7dc 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Tue Jul 12 14:03:05 UTC 2011 - aj@suse.de + +- Create submenu for all besides primary Linux kernels. +- Only run preun section during package install but not during + upgrade. + +------------------------------------------------------------------- +Tue Jul 12 11:48:08 UTC 2011 - aj@suse.de + +- Update README.openSUSE + ------------------------------------------------------------------- Tue May 31 10:42:29 CEST 2011 - jslaby@suse.de diff --git a/grub2.spec b/grub2.spec index 78394ea..6294611 100644 --- a/grub2.spec +++ b/grub2.spec @@ -51,6 +51,7 @@ Source5: translations-20110531.tar.bz2 Patch0: gcc46-fixes.patch Patch2: grub2-linux.patch Patch3: gccwarn.patch +Patch4: grub2-linux-submenu.patch PreReq: perl-Bootloader Requires: gettext-runtime Requires(post): /sbin/install-info @@ -81,6 +82,7 @@ sed -i 's,grub.texi,grub2.texi,' docs/Makefile.am %patch0 -p1 %patch2 -p0 %patch3 -p1 +%patch4 -p1 # README.openSUSE cp %{SOURCE3} . @@ -148,30 +150,18 @@ fi if [ $1 = 0 ]; then /sbin/install-info --delete %{_infodir}/grub-dev.info %{_infodir}/dir || : /sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || : + exec >/dev/null + if [ -e /boot/%{name}/core.img ] ; then + /sbin/update-bootloader --remove --image /boot/%{name}/core.img --name="GNU GRUB 2" || : + /sbin/update-bootloader --refresh || : + fi + # Cleanup installed files + rm -f /boot/%{name}/*.mod + rm -f /boot/%{name}/*.img + rm -f /boot/%{name}/*.lst + rm -f /boot/%{name}/device.map fi -exec >/dev/null -if [ -e /boot/%{name}/core.img ] ; then - /sbin/update-bootloader --remove --image /boot/%{name}/core.img --name="GNU GRUB 2" || : - /sbin/update-bootloader --refresh || : - ## XXX Ugly - rm -f /boot/%{name}/*.mod - rm -f /boot/%{name}/*.img - rm -f /boot/%{name}/*.lst - rm -f /boot/%{name}/device.map -fi - -#%%triggerin -- kernel, kernel-PAE -#exec >/dev/null 2>&1 -## Generate grub.cfg -#%%{name}-mkconfig -# -# -#%%triggerun -- kernel, kernel-PAE -#exec >/dev/null 2>&1 -## Generate grub.cfg -#%%{name}-mkconfig - %files -f grub.lang %defattr(-,root,root,-) %{_libdir}/%{name}