Permalink
Browse files

dracut: Added bootloader plugin

This plugin generates a new initramfs.
Use /etc/dracut.conf to configure dracut.
  • Loading branch information...
cavalier38 committed Nov 2, 2012
1 parent 33edf46 commit 232d3629fbd768a9b961b35dfa9a32b1bdb19db1
Showing with 34 additions and 0 deletions.
  1. +34 −0 kernel/dracut/plugin.d/bootloader-dracut.plugin
@@ -0,0 +1,34 @@
+#!/bin/bash
+#############################################################
+# #
+# bootloader-dracut.plugin - plugin that generate initramfs #
+# #
+#############################################################
+# #
+# Copyright 2005 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

0 comments on commit 232d362

Please sign in to comment.