e0e6dde32f
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 <jhlavac@redhat.com>
49 lines
1.6 KiB
Bash
Executable File
49 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
[[ -f /etc/os-release ]] && . /etc/os-release
|
|
[[ -f /etc/sysconfig/kernel ]] && . /etc/sysconfig/kernel
|
|
|
|
COMMAND="$1"
|
|
KERNEL_VERSION="$2"
|
|
BOOT_DIR_ABS="$3"
|
|
KERNEL_IMAGE="$4"
|
|
|
|
MACHINE_ID=$KERNEL_INSTALL_MACHINE_ID
|
|
|
|
BLS_DIR="/boot/loader/entries"
|
|
|
|
[[ "$KERNEL_VERSION" == *\+* ]] && flavor=-"${KERNEL_VERSION##*+}"
|
|
case "$COMMAND" in
|
|
add)
|
|
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
|
|
fi
|
|
|
|
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
|
|
read -r -d '' -a line < /proc/cmdline
|
|
for i in "${line[@]}"; do
|
|
[[ "${i#initrd=*}" != "$i" ]] && continue
|
|
BOOT_OPTIONS+=("$i")
|
|
done
|
|
fi
|
|
|
|
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
|
|
echo "Could not determine the kernel command line parameters." >&2
|
|
echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
|
|
exit 1
|
|
fi
|
|
|
|
BLS_RESCUE="${BLS_DIR}/${MACHINE_ID}-0-rescue.conf"
|
|
if [[ -f "${BLS_RESCUE}" ]] && grep -q '^options.*$kernelopts' "${BLS_RESCUE}"; then
|
|
sed -i -e "s,^linux.*,linux /boot/vmlinuz-0-rescue-${MACHINE_ID},g" "${BLS_RESCUE}"
|
|
sed -i -e "s,^initrd.*,initrd /boot/initramfs-0-rescue-${MACHINE_ID}.img,g" "${BLS_RESCUE}"
|
|
sed -i -e "s#^options.*#options ${BOOT_OPTIONS[*]}#g" "${BLS_RESCUE}"
|
|
fi
|
|
fi
|
|
;;
|
|
*)
|
|
;;
|
|
esac
|