Always regenerate initrd

Even if it already exists. This may happen if kernel-<...>-devel is
installed first, triggers rebuild of DKMS modules and some of these
request remaking of initrd. The initrd that is created then will be
non-functional. But when the user installs kernel-<...> package, that
defunct initrd will be replaced with a working one here.
This commit is contained in:
Eugene Shatokhin 2015-04-22 10:35:53 +03:00
parent 3f8c750033
commit 7cc486719f

View file

@ -1487,14 +1487,16 @@ EOF
%endif
### Create kernel Post script
# We always regenerate initrd here, even if it already exists. This may
# happen if kernel-<...>-devel is installed first, triggers rebuild of
# DKMS modules and some of these request remaking of initrd. The initrd
# that is created then will be non-functional. But when the user installs
# kernel-<...> package, that defunct initrd will be replaced with a working
# one here.
cat > $kernel_files-post <<EOF
INITRD=/boot/initrd-$KernelVer.img
/sbin/dracut -f \${INITRD} $KernelVer
if [ ! -e \${INITRD} ]; then
/sbin/dracut \${INITRD} $KernelVer
else
printf "WARNING: Initrd image \${INITRD} already exists and will not be replaced.\n"
fi
/usr/sbin/update-grub2
pushd /boot > /dev/null