/
bootloader-dracut.plugin
34 lines (25 loc) · 1.12 KB
/
bootloader-dracut.plugin
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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="$1-$(arch)"
# 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" "$1"
# right now we want to have it run all bootloaders?
return 2
}
plugin_register KERNEL_UPDATEBOOTLOADER plugin_kernel_updatebootloader_dracut