Skip to content

Commit

Permalink
profiles/features/dist-kernel/bashrc: Preserve /boot files for same slot
Browse files Browse the repository at this point in the history
After a new kernel and initramfs for the same kernel version have been
built, the old kernel and initramfs are still useful as a fail-safe
option if the new kernel lacks any necessary in-kernel configuration
options and cannot boot with the new initramfs as a result.

Signed-off-by: Yuan Liao <liaoyuan@gmail.com>
  • Loading branch information
Leo3418 committed Jan 28, 2024
1 parent 89973e2 commit 4c4e35d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions profiles/features/dist-kernel/bashrc/dist-kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,20 @@ if has kernel-install ${INHERITED}; then
fi
fi

local to_rm=()
local file
for file in \
"${EROOT}/boot/"{config,System.map,vmlinuz}"-${KV_REL}"{,.old} \
"${EROOT}/boot/initramfs-${KV_REL}.img"{,.old}; do
[[ -e ${file} ]] && to_rm+=( "${file}" )
done
if [[ ${#to_rm[@]} != 0 ]]; then
ebegin "Removing kernel files under /boot"
rm "${to_rm[@]}"
eend $?
fi

if [[ -z ${REPLACED_BY_VERSION} ]]; then
local to_rm=()
local file
for file in \
"${EROOT}/boot/"{config,System.map,vmlinuz}"-${KV_REL}"{,.old} \
"${EROOT}/boot/initramfs-${KV_REL}.img"{,.old}; do
[[ -e ${file} ]] && to_rm+=( "${file}" )
done
if [[ ${#to_rm[@]} != 0 ]]; then
ebegin "Removing kernel files under /boot"
rm "${to_rm[@]}"
eend $?
fi

ebegin "Updating bootloader configuration"
"${EROOT}/etc/kernel/postinst.d/91-grub-mkconfig.install"
eend $?
Expand Down

0 comments on commit 4c4e35d

Please sign in to comment.