Skip to content

Instantly share code, notes, and snippets.

@snazzybunny
Created September 7, 2017 05:51
Show Gist options
  • Save snazzybunny/d2bf911b4c72eeb397233ac953d0a432 to your computer and use it in GitHub Desktop.
Save snazzybunny/d2bf911b4c72eeb397233ac953d0a432 to your computer and use it in GitHub Desktop.
recreate initramfs and update grub entries
#!/bin/bash
KERNEL_VERSION=$(ls -t /lib/modules/ |grep 'bootstrap\|jwrdegoede' |head -n 1)
# recreate initramfs image
if [ -f /usr/sbin/update-initramfs ]; then
update-initramfs -c -k ${KERNEL_VERSION} || update-initramfs -u -k ${KERNEL_VERSION}
elif [ -f /usr/bin/dracut ]; then
dracut -f /boot/initrd.img-${KERNEL_VERSION} ${KERNEL_VERSION}
elif [ -f /usr/bin/mkinitcpio ]; then
mkinitcpio -c /etc/mkinitcpio.conf -g /boot/initrd.img-${KERNEL_VERSION} -k ${KERNEL_VERSION} || true
fi
# Update grub config
if [ -f /usr/bin/grub-mkconfig ]; then
grub-mkconfig -o /boot/grub/grub.cfg
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment