diskimage-builder/elements/fedora-minimal/install.d/99-ramdisk
Ian Wienand a67ee17d62 Clarify what fedora-minimal/install.d/99-ramdisk is doing
Clarify what this script is doing.  It currently fails on some
platforms due to earlier errors, see
Ibcce35da928f64e6a719b070bcc833346ee7ee92

Change-Id: Id4c04d7ae20068643df34d2fa31068e8a917a52d
2015-11-04 06:23:17 +11:00

29 lines
836 B
Bash
Executable File

#!/bin/bash
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
set -x
fi
set -eu
set -o pipefail
# The RPM postinst packages for "kernel-core" have used kernel-install
# to (quoting from man)
#
# add KERNEL-VERSION KERNEL-IMAGE
# kernel-install creates the directory /boot/MACHINE-ID/KERNEL-VERSION/
# and calls every executable /usr/lib/kernel/install.d/*.install and
# /etc/kernel/install.d/*.install ...
#
# We just want the initrd in /boot. Our later grub scripts will fix
# up the bootloader configuration
initrd=$(find /boot -name initrd)
kernel_version=$(rpm -qa | grep kernel | sort | head -n 1 | cut -d '-' -f 2,3)
if [ -n "$initrd" -a $(echo "$initrd" | wc -l) -eq 1 ]; then
cp $initrd /boot/initrd-$kernel_version.img
else
echo "Zero or multiple initrds found. This should not happen."
exit 1
fi