2015-03-22 14:04:46 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
|
|
|
|
set -x
|
|
|
|
fi
|
|
|
|
set -eu
|
|
|
|
set -o pipefail
|
|
|
|
|
2015-10-27 04:10:41 +00:00
|
|
|
# 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
|
|
|
|
|
2015-03-22 14:04:46 +00:00
|
|
|
initrd=$(find /boot -name initrd)
|
|
|
|
kernel_version=$(rpm -qa | grep kernel | sort | head -n 1 | cut -d '-' -f 2,3)
|
|
|
|
|
2015-10-16 02:11:14 +00:00
|
|
|
if [ -n "$initrd" -a $(echo "$initrd" | wc -l) -eq 1 ]; then
|
2015-03-22 14:04:46 +00:00
|
|
|
cp $initrd /boot/initrd-$kernel_version.img
|
|
|
|
else
|
|
|
|
echo "Zero or multiple initrds found. This should not happen."
|
|
|
|
exit 1
|
|
|
|
fi
|