From cb145202eab9f4d610c12e71e9c3c1445c66d6c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Mon, 2 Dec 2019 13:36:43 +0100 Subject: [PATCH] apply kernel install/update script fixes from #1600480, #1665060 --- 00-zipl-prepare.install | 9 +++++++++ 20-zipl-kernel.install | 29 ++++++++++++++++++++++++++++- s390utils.spec | 16 ++++++++++++---- 3 files changed, 49 insertions(+), 5 deletions(-) create mode 100755 00-zipl-prepare.install diff --git a/00-zipl-prepare.install b/00-zipl-prepare.install new file mode 100755 index 0000000..315b2f9 --- /dev/null +++ b/00-zipl-prepare.install @@ -0,0 +1,9 @@ +#!/bin/bash + +COMMAND="$1" +KERNEL_VERSION="$2" +BOOT_DIR_ABS="$3" +KERNEL_IMAGE="$4" + +# Remove it, since for zipl the images are always installed in /boot +rm -rf "${BOOT_DIR_ABS%/*}" diff --git a/20-zipl-kernel.install b/20-zipl-kernel.install index 33b7d11..7315095 100755 --- a/20-zipl-kernel.install +++ b/20-zipl-kernel.install @@ -16,6 +16,7 @@ KERNEL_DIR="${KERNEL_IMAGE%/*}" MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID BLS_DIR="/boot/loader/entries" +ZIPLCFG="/etc/zipl.conf" CMDLINE_LINUX_DEBUG=" systemd.log_level=debug systemd.log_target=kmsg" LINUX_DEBUG_VERSION_POSTFIX="_with_debugging" LINUX_DEBUG_TITLE_POSTFIX=" with debugging" @@ -106,6 +107,15 @@ case "$COMMAND" in "${BOOT_OPTIONS[*]}" >"${BLS_TARGET}" fi + if [[ "$KERNEL_VERSION" == *\+* ]] && [ "x$DEFAULTDEBUG" != "xyes" ]; then + UPDATEDEFAULT="no" + fi + + if [[ "x$UPDATEDEFAULT" = "xyes" ]]; then + TITLE="$(grep '^title[ \t]' "${BLS_TARGET}" | sed -e 's/^title[ \t]*//')" + NEWDEFAULT="${TITLE}" + fi + if [ "x${MAKEDEBUG}" = "xyes" ]; then BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" cp -aT "${BLS_TARGET}" "${BLS_DEBUG}" @@ -116,8 +126,16 @@ case "$COMMAND" in sed -i -e "s/^version.*/version ${VERSION}${LINUX_DEBUG_VERSION_POSTFIX}/" "${BLS_DEBUG}" sed -i -e "s/^id.*/${BLSID}/" "${BLS_DEBUG}" sed -i -e "s#^options.*#options ${BOOT_OPTIONS[*]}${CMDLINE_LINUX_DEBUG}#" "${BLS_DEBUG}" + if [ -n "$NEWDEFAULT" -a "x$DEFAULTDEBUG" = "xyes" ]; then + TITLE="$(grep '^title[ \t]' "${BLS_DEBUG}" | sed -e 's/^title[ \t]*//')" + NEWDEFAULT="${TITLE}" + fi fi + if [ -n "$NEWDEFAULT" ]; then + sed -i -e "s,^default=.*,default=${NEWDEFAULT}," "${ZIPLCFG}" + fi + exit 0 fi @@ -131,7 +149,16 @@ case "$COMMAND" in if [[ ! -f /sbin/new-kernel-pkg ]]; then ARCH="$(uname -m)" BLS_TARGET="${BLS_DIR}/${MACHINE_ID}-${KERNEL_VERSION}.conf" - BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/\.${ARCH}/-debug.${ARCH}/")" + BLS_DEBUG="$(echo ${BLS_TARGET} | sed -e "s/${KERNEL_VERSION}/${KERNEL_VERSION}~debug/")" + + TITLE="$(grep '^title[ \t]' "${BLS_TARGET}" | sed -e 's/^title[ \t]*//')" + sed -i -e "/^default=${TITLE}/d" "${ZIPLCFG}" + + if [[ -f "${BLS_DEBUG}" ]]; then + TITLE="$(grep '^title[ \t]' "${BLS_DEBUG}" | sed -e 's/^title[ \t]*//')" + sed -i -e "/^default=${TITLE}/d" "${ZIPLCFG}" + fi + rm -f "${BLS_TARGET}" "${BLS_DEBUG}" for i in vmlinuz System.map config zImage.stub dtb; do diff --git a/s390utils.spec b/s390utils.spec index 3b9d9f9..540252d 100644 --- a/s390utils.spec +++ b/s390utils.spec @@ -8,7 +8,7 @@ Name: s390utils Summary: Utilities and daemons for IBM z Systems Version: 2.11.0 -Release: 1%{?dist} +Release: 2%{?dist} Epoch: 2 License: MIT ExclusiveArch: s390 s390x @@ -27,9 +27,10 @@ Source15: device_cio_free.service Source16: ccw_init Source17: ccw.udev Source21: normalize_dasd_arg -Source22: 20-zipl-kernel.install -Source23: 52-zipl-rescue.install -Source24: 91-zipl.install +Source22: 00-zipl-prepare.install +Source23: 20-zipl-kernel.install +Source24: 52-zipl-rescue.install +Source25: 91-zipl.install %if 0%{?signzipl} %define pesign_name redhatsecureboot302 @@ -120,8 +121,10 @@ install -Dp -m 644 etc/modules-load.d/*.conf %{buildroot}%{_prefix}/lib/modules- # Install kernel-install scripts install -d -m 0755 %{buildroot}%{_prefix}/lib/kernel/install.d/ install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE22} +install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ zfcpdump/10-zfcpdump.install install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE23} install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE24} +install -D -m 0755 -t %{buildroot}%{_prefix}/lib/kernel/install.d/ %{SOURCE25} install -d -m 0755 %{buildroot}%{_sysconfdir}/kernel/install.d/ install -m 0644 /dev/null %{buildroot}%{_sysconfdir}/kernel/install.d/20-grubby.install @@ -470,6 +473,8 @@ systemctl --no-reload preset device_cio_free.service >/dev/null 2>&1 || : %{_udevrulesdir}/81-ccw.rules %{_udevrulesdir}/90-cpi.rules %{_sysconfdir}/kernel/install.d/20-grubby.install +%{_prefix}/lib/kernel/install.d/00-zipl-prepare.install +%{_prefix}/lib/kernel/install.d/10-zfcpdump.install %{_prefix}/lib/kernel/install.d/20-zipl-kernel.install %{_prefix}/lib/kernel/install.d/52-zipl-rescue.install %{_prefix}/lib/kernel/install.d/91-zipl.install @@ -766,6 +771,9 @@ User-space development files for the s390/s390x architecture. %changelog +* Mon Dec 02 2019 Dan Horák - 2:2.11.0-2 +- apply kernel install/update script fixes from #1600480, #1665060 + * Mon Sep 09 2019 Dan Horák - 2:2.11.0-1 - rebased to 2.11.0