SHA256
1
0
forked from pool/grub2

Accepting request 454860 from home:michael-chang:bsc:1022880

- grub2-systemd-sleep.sh: Fix prematurely abort by commands error return code
  and skip the offending menu entry (bsc#1022880)

OBS-URL: https://build.opensuse.org/request/show/454860
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=249
This commit is contained in:
Andrei Borzenkov 2017-02-06 09:09:16 +00:00 committed by Git OBS Bridge
parent de20a58080
commit 8456dc36e5
2 changed files with 17 additions and 6 deletions

View File

@ -18,7 +18,7 @@ error_quit()
check-system()
{
[ -x "${GRUB_ONCE}" ] || error_quit "ERROR: cannot find or execute ${GRUB_EDITENV}"
[ -x "${GRUB_ONCE}" ] || error_quit "ERROR: cannot find or execute ${GRUB_ONCE}"
[ -x "${GRUB_EDITENV}" ] || error_quit "ERROR: cannot find or execute ${GRUB_EDITENV}"
[ -x "${BLKID}" ] || error_quit "ERROR: cannot find or execute ${BLKID}"
[ -r "${GRUB_CONF}" ] || error_quit "ERROR: cannot find or read ${GRUB_CONF}"
@ -60,7 +60,7 @@ get-kernels()
;;
linux*noresume*|module*xen*noresume*)
echo " Skipping grub entry #${J}, because it has the noresume option" >&2
echo " Skipping ${MENU_ENTRIES[$I]}, because it has the noresume option" >&2
;;
linux*root=*|module*xen*root=*)
local ROOT
@ -71,15 +71,20 @@ get-kernels()
if [ x"${ROOT:0:5}" = "xUUID=" ]; then
UUID=${ROOT#UUID=}
if [ -n "$UUID" ]; then
ROOT=$($BLKID -U $UUID)
ROOT=$($BLKID -U $UUID || true)
if [ -z "$ROOT" ]; then
echo " Skipping ${MENU_ENTRIES[$I]}, because its root device $UUID is not found" >&2
continue
fi
fi
fi
if [ "$(stat -Lc '%t:%T' $ROOT)" != "$(stat -Lc '%t:%T' $ROOTDEV)" ]; then
echo " Skipping grub entry #${J}, because its root= parameter ($ROOT)" >&2
if [ "$(stat -Lc '%t:%T' $ROOT || true)" != "$(stat -Lc '%t:%T' $ROOTDEV || true)" ]; then
echo " Skipping ${MENU_ENTRIES[$I]}, because its root= parameter ($ROOT)" >&2
echo " does not match the current root device ($ROOTDEV)." >&2
continue
fi
DUMMY=($LINE) # kernel (hd0,1)/boot/vmlinuz-ABC root=/dev/hda2
KERNELS[$I]=${DUMMY[1]##*/} # vmlinuz-ABC
# DEBUG "Found kernel entry #${I}: '${DUMMY[1]##*/}'" INFO
@ -87,7 +92,7 @@ get-kernels()
;;
linux*|module*xen*)
# a kernel without "root="? We better skip that one...
echo " Skipping grub entry #${J}, because it has no root= option" >&2
echo " Skipping ${MENU_ENTRIES[$I]}, because it has no root= option" >&2
;;
*) ;;
esac

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Feb 3 08:18:30 UTC 2017 - mchang@suse.com
- grub2-systemd-sleep.sh: Fix prematurely abort by commands error return code
and skip the offending menu entry (bsc#1022880)
-------------------------------------------------------------------
Wed Feb 1 21:42:49 UTC 2017 - agraf@suse.com