update_grub_config() { if [ -f /boot/grub/grub.cfg ]; then /usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg fi } remove_old_initrd() { # we remove every initrd except the one we just created find /boot -type f -name "initramfs-*fw*.img" ! -name "*@_F_kernelmod_uname@.img" -delete # also remove old initrd style files find /boot -type f -name "initrd-*fw*" -delete } post_install() { # Creating initial not-Hostonly dracut-image /usr/bin/dracut -N -a "dmsquash-live pollcdrom" --kver @_F_kernelmod_uname@ update_grub_config } post_upgrade() { # Create new initrd but this time value taken from dracut config file # we need force bc the relbumps , we installed already another kernel /usr/bin/dracut --force --kver @_F_kernelmod_uname@ # cleanup remove_old_initrd # well just to be sure right ? if [ ! -e /boot/initramfs-@_F_kernelmod_uname@.img ]; then echo "Cannot find the just created initramfs!!.. Trying to recover.." /usr/bin/dracut --force --kver @_F_kernelmod_uname@ fi ## paranoia!! but better tell what's going on and do not let the user reboot if [ ! -e /boot/initramfs-@_F_kernelmod_uname@.img ]; then echo "ERROR occured , DO NOT REBOOT YOUR BOX.." echo "Run the following comand manually ( as root or using sudo):" echo " /usr/bin/dracut --force --kver @_F_kernelmod_uname@" fi update_grub_config } op=$1 shift $op $* # vim: ft=sh