diff --git a/grub2-systemd-sleep.sh b/grub2-systemd-sleep.sh index 06a76a3..354991f 100644 --- a/grub2-systemd-sleep.sh +++ b/grub2-systemd-sleep.sh @@ -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 diff --git a/grub2.changes b/grub2.changes index 0db4245..50b16b5 100644 --- a/grub2.changes +++ b/grub2.changes @@ -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