#!/bin/sh -x


kver="$(rpm -qa 'kernel-image*' --queryformat '%{version}-%{name}-%{release}\n' | head -n 1|sed 's/kernel-image-//')"
subst 's/AUTODETECT/#AUTODETECT/' /etc/initrd.mk


if [ -f /etc/plymouth/plymouthd.conf ];then 
    subst 's/#\([T\[]\)/\1/' /etc/plymouth/plymouthd.conf
    echo 'FEATURES += nfs plymouth propagator' > /etc/initrd.mk
else
    echo 'FEATURES += nfs propagator' > /etc/initrd.mk
fi

make-initrd --no-checks -k $kver
gzip < /boot/initrd-$kver.img > $(getconf LIBDIR)/propagator/initfs
[ -h /boot/vmlinuz ] ||  ln -s vmlinuz-$kver /boot/vmlinuz
[ -h /boot/initrd.img ] || ln -s initrd-$kver.img /boot/initrd.img
