Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

dracut: Added bootloader plugin #151

Merged
merged 2 commits into from Nov 2, 2012
Jump to file or symbol
Failed to load files and symbols.
+34 −0
Split
@@ -0,0 +1,34 @@
+#!/bin/bash
+#############################################################
+# #
+# bootloader-dracut.plugin - plugin that generate initramfs #
+# #
+#############################################################
+# #
+# Copyright 2012 by Peter de Ridder under GPLv2 #
+# #
+#############################################################
+
+
+plugin_kernel_updatebootloader_dracut()
+{
+ local KVERSION
+
+ debug_msg "plugin_kernel_updatebootloader_dracut ($@)"
+
+ KVERSION=`echo $1 | cut -d- -f1`
+
+ # create an old copy of the previous initramfs
+ if [ -f "/boot/initramfs-$KVERSION.img" ]; then
+ cp -p "/boot/initramfs-$KVERSION.img" "/boot/initramfs-$KVERSION.old.img"
+ fi
+
+ # we can force dracut as we copied the old initramfs
+ dracut -f "/boot/initramfs-$KVERSION.img" "$KVERSION"
+
+ # right now we want to have it run all bootloaders?
+ return 2
+}
+
+
+plugin_register KERNEL_UPDATEBOOTLOADER plugin_kernel_updatebootloader_dracut