Hello community,

here is the log from the commit of package grub2 for openSUSE:Factory checked 
in at 2012-09-23 21:04:15
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/grub2 (Old)
 and      /work/SRC/openSUSE:Factory/.grub2.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "grub2", Maintainer is ""

Changes:
--------
--- /work/SRC/openSUSE:Factory/grub2/grub2.changes      2012-08-31 
09:28:15.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.grub2.new/grub2.changes 2012-09-23 
21:04:17.000000000 +0200
@@ -1,0 +2,13 @@
+Wed Sep 19 18:54:34 UTC 2012 - arvidj...@gmail.com
+
+- add 20_memtest86+ (bnc#780622) 
+
+-------------------------------------------------------------------
+Tue Sep 18 09:26:29 UTC 2012 - mch...@suse.com
+
+- Fix un-bootable grub2 testing entry in grub's menu.lst (bnc#779370) 
+- Not add new grub2 testing entry if it's not found in menu.lst
+- Update grub2 stuff and config if there's grub2 entry in menu.lst
+- Check for current bootloader as update-bootloader acts on it
+
+-------------------------------------------------------------------

New:
----
  20_memtest86+

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ grub2.spec ++++++
--- /var/tmp/diff_new_pack.lHZNVI/_old  2012-09-23 21:04:18.000000000 +0200
+++ /var/tmp/diff_new_pack.lHZNVI/_new  2012-09-23 21:04:18.000000000 +0200
@@ -78,6 +78,7 @@
 # rsync -Lrtvz  translationproject.org::tp/latest/grub/ po
 Source5:        translations-20120622.tar.xz
 Source6:        grub2-once
+Source7:        20_memtest86+
 Source1000:     PATCH_POLICY
 Patch0:         grub2-correct-font-path.patch
 Patch1:         rename-grub-info-file-to-grub2.patch
@@ -254,6 +255,9 @@
 # Script that makes part of grub.cfg persist across updates
 install -m 755 %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/grub.d/
 
+# Script to generate memtest86+ menu entry
+install -m 755 %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/grub.d/
+
 # Ghost config file
 install -d $RPM_BUILD_ROOT/boot/%{name}
 touch $RPM_BUILD_ROOT/boot/%{name}/grub.cfg
@@ -272,39 +276,93 @@
 /sbin/install-info %{_infodir}/grub-dev.info %{_infodir}/dir || :
 /sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :
 
-mkdir -p /boot/%{name}/ 2>/dev/null || true
-# Determine the partition with /boot
-BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}'))
-# Generate core.img, but don't let it be installed in boot sector
-%{name}-install --grub-setup=/bin/true $BOOT_PARTITION || true
-exec >/dev/null 2>&1
-# Remove stale menu.lst entries
-/sbin/update-bootloader --remove --image /boot/%{name}/core.img --name="GNU 
GRUB 2" || true
-# Add core.img as multiboot kernel to GRUB Legacy menu
-/sbin/update-bootloader --add --image /boot/%{name}/core.img --name="GNU GRUB 
2" || true
-/sbin/update-bootloader --refresh || true
+# To check by current loader settings
+if [ -f %{_sysconfdir}/sysconfig/bootloader ]; then
+  . %{_sysconfdir}/sysconfig/bootloader
+fi
+
+# If the grub is the current loader, we'll handle the grub2 testing entry
+if [ "x${LOADER_TYPE}" = "xgrub" ]; then
+
+  exec >/dev/null 2>&1
+
+  # check if entry for grub2's core.img exists in the config
+  # if yes, we will correct obsoleted path and update grub2 stuff and config 
to make it work
+  # if no, do nothing
+  if [ -f /boot/grub/menu.lst ]; then
+
+    # If grub config contains obsolete core.img path, remove and use the new 
one
+    if /usr/bin/grep -l "^\s*kernel\s*.*/boot/%{name}/core.img" 
/boot/grub/menu.lst; then
+      /sbin/update-bootloader --remove --image /boot/%{name}/core.img || true
+      /sbin/update-bootloader --add --image /boot/%{name}/i386-pc/core.img 
--name "GNU GRUB 2" || true
+    fi
+
+    # Install grub2 stuff and config to make the grub2 testing entry to work 
with updated version
+    if /usr/bin/grep -l "^\s*kernel\s*.*/boot/%{name}/i386-pc/core.img" 
/boot/grub/menu.lst; then
+      # Determine the partition with /boot
+      BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}'))
+      # Generate core.img, but don't let it be installed in boot sector
+      %{name}-install --grub-setup=/bin/true $BOOT_PARTITION || true
+      # Create a working grub2 config, otherwise that entry is un-bootable
+      /usr/sbin/grub2-mkconfig -o /boot/%{name}/grub.cfg
+    fi
+  fi
+
+elif [ "x${LOADER_TYPE}" = "xgrub2" ]; then
+
+  # It's enought to call update-bootloader --refesh to install grub2 and 
update it's config
+  /sbin/update-bootloader --refresh || true
+fi
 
 %ifarch %{efi}
 
 %post efi
 /sbin/install-info %{_infodir}/grub-dev.info %{_infodir}/dir || :
 /sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :
+
+# To check by current loader settings
+if [ -f %{_sysconfdir}/sysconfig/bootloader ]; then
+  . %{_sysconfdir}/etc/sysconfig/bootloader
+fi
+if [ "x${LOADER_TYPE}" = "xgrub2-efi" ]; then
+
+  # It's enought to call update-bootloader --refesh to install grub2 and 
update it's config
+  /sbin/update-bootloader --refresh || true
+fi
 %endif
 
 %preun
 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 || :
+
+  # To check by current loader settings
+  if [ -f %{_sysconfdir}/sysconfig/bootloader ]; then
+    . %{_sysconfdir}/sysconfig/bootloader
    fi
+
+  if [ "x${LOADER_TYPE}" = "xgrub" ]; then
+
+    exec >/dev/null 2>&1
+
+    if [ -f /boot/grub/menu.lst ]; then
+
+      # Remove grub2 testing entry in menu.lst if has any
+      for i in /boot/%{name}/core.img /boot/%{name}/i386-pc/core.img; do
+        if /usr/bin/grep -l "^\s*kernel\s*.*$i" /boot/grub/menu.lst; then
+          /sbin/update-bootloader --remove --image "$i" || true
+        fi
+      done
+    fi
+
+    # Cleanup config, to not confuse some tools determining bootloader in use
+    rm -f /boot/%{name}/grub.cfg
+
    # Cleanup installed files
-   rm -f /boot/%{name}/*.mod
-   rm -f /boot/%{name}/*.img
-   rm -f /boot/%{name}/*.lst
-   rm -f /boot/%{name}/device.map
+    # Unless grub2 provides grub2-uninstall, we don't remove any file because
+    # we have no idea what's been installed. (And a blind remove is dangerous
+    # to remove user's or other package's file accidently ..)
+  fi
 fi
 
 %ifarch %{efi}

++++++ 20_memtest86+ ++++++
#! /bin/sh
set -e

# grub-mkconfig helper script.
# Copyright (C) 2011  Michal Ambroz <re...@seznam.cz>
# Adapted for openSUSE by Andrey Borzenkov <arvidj...@gmail.com>
#
# 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.
#
# 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 the script.  If not, see <http://www.gnu.org/licenses/>.

. /usr/share/grub2/grub-mkconfig_lib

export TEXTDOMAIN=grub2
export TEXTDOMAINDIR=/usr/share/locale

CLASS="--class memtest86 --class gnu --class tools"

if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
  OS=Memtest
else
  OS="${GRUB_DISTRIBUTOR} Memtest"
  CLASS="--class $(echo ${GRUB_DISTRIBUTOR} | tr 'A-Z' 'a-z' | cut -d' ' -f1) 
${CLASS}"
fi

memtest=/boot/memtest.bin

if grub_file_is_not_garbage "$memtest" ; then
  gettext_printf "Found memtest image: %s\n" "$memtest" >&2
  basename=`basename $memtest`
  dirname=`dirname $memtest`
  rel_dirname=`make_system_path_relative_to_its_root $dirname`
  boot_device_id="$(grub_get_device_id "${GRUB_DEVICE_BOOT}")"

  printf "menuentry '%s' %s \$menuentry_id_option '%s' {\n" "${OS}" "${CLASS}" 
"memtest-$boot_device_id"
  prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed 
-e "s/^/\t/")"
  printf '%s\n' "${prepare_boot_cache}"
  message="$(gettext_printf "Loading memtest ...\n")"
  cat << EOF
        echo    '$message'
        linux16 ${rel_dirname}/${basename}
}
EOF
fi


-- 
To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org
For additional commands, e-mail: opensuse-commit+h...@opensuse.org

Reply via email to