From e0e6dde32f97a6fdfcfe3dbbabfe348afb5cf38a Mon Sep 17 00:00:00 2001 From: Jan Hlavac Date: Fri, 29 Nov 2019 16:57:18 +0000 Subject: [PATCH] kernel-install: fix BLS-related decision logic In the commit 63205a4dc4c400f75571869d87682c0cdb475830, there was introduced a change in the decision logic of the 20-zipl-kernel.install script. Specifically, whether the Boot Loader Specification (BLS) is used. Instead of just checking the existence of the /sbin/new-kernel-pkg file, the existence of the /boot/loader/entries directory is also checked. More thorough testing revealed that the above commit covers only the case when a new kernel is added. However, the remaining cases should also be covered. That means the case when a rescue kernel is added and the case when some kernel is removed. Resolves: #1778243 Fixes: #1755899 Signed-off-by: Jan Hlavac --- 20-zipl-kernel.install | 4 ++-- 52-zipl-rescue.install | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/20-zipl-kernel.install b/20-zipl-kernel.install index 91d7581..41ff2e5 100755 --- a/20-zipl-kernel.install +++ b/20-zipl-kernel.install @@ -74,7 +74,7 @@ case "$COMMAND" in fi fi - if [[ ! -f /sbin/new-kernel-pkg || -d "$BLS_DIR" ]]; then + if [[ ! -f /sbin/new-kernel-pkg || -d "${BLS_DIR}" ]]; then declare -a BOOT_OPTIONS if [[ -f /etc/kernel/cmdline ]]; then read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline @@ -146,7 +146,7 @@ case "$COMMAND" in exit 77 ;; remove) - if [[ ! -f /sbin/new-kernel-pkg ]]; then + if [[ ! -f /sbin/new-kernel-pkg || -d "${BLS_DIR}" ]]; then ARCH="$(uname -m)" BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" diff --git a/52-zipl-rescue.install b/52-zipl-rescue.install index a2945f7..dbf0c1b 100755 --- a/52-zipl-rescue.install +++ b/52-zipl-rescue.install @@ -15,7 +15,7 @@ BLS_DIR="/boot/loader/entries" [[ "$KERNEL_VERSION" == *\+* ]] && flavor=-"${KERNEL_VERSION##*+}" case "$COMMAND" in add) - if [[ ! -f /sbin/new-kernel-pkg ]]; then + if [[ ! -f /sbin/new-kernel-pkg || -d "${BLS_DIR}" ]]; then declare -a BOOT_OPTIONS if [[ -f /etc/kernel/cmdline ]]; then read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline