Skip to content

Commit

Permalink
Fixup initramfs rebuild process
Browse files Browse the repository at this point in the history
At the time the DKMS kernel module is built and installed,
it's entirely possible that the utilities expected to be included
are not yet installed. Thus, DKMS will no longer produce the initramfs
and it'll be done by dattobd-utils instead. This way, dbdctl and friends
will be installed and properly included in the initramfs.
  • Loading branch information
Conan-Kudo committed Jan 24, 2017
1 parent eb1c108 commit 6d1cd13
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dist/dattobd-dkms-conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ DEST_MODULE_LOCATION[0]="/kernel/drivers/block/"

NO_WEAK_MODULES="yes"
AUTOINSTALL="yes"
REMAKE_INITRD="yes"
REMAKE_INITRD="no"

39 changes: 39 additions & 0 deletions dist/dattobd.spec
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,45 @@ else
fi


%post utils
%if 0%{?rhel} != 5
# Generate initramfs
if type "dracut" &> /dev/null; then
echo "Configuring dracut, please wait..."
dracut -f
elif type "mkinitrd" &> /dev/null; then
echo "Configuring initrd, please wait..."
mkinitrd
elif type "update-initramfs" &> /dev/null; then
echo "Configuring initramfs, please wait..."
update-initramfs -u
fi
sleep 1
%endif


%postun utils
%if 0%{?rhel} != 5
%if 0%{?debian} || 0%{?ubuntu}
if [ "$1" = "remove" ] || [ "$1" = "purge" ]; then
%else
if [ $1 -eq 0 ]; then
%endif

if type "dracut" &> /dev/null; then
echo "Configuring dracut, please wait..."
dracut -f
elif type "mkinitrd" &> /dev/null; then
echo "Configuring initrd, please wait..."
mkinitrd
elif type "update-initramfs" &> /dev/null; then
echo "Configuring initramfs, please wait..."
update-initramfs -u
fi
fi
%endif


%clean
# EL5 and SLE 11 require this section
rm -rf %{buildroot}
Expand Down

0 comments on commit 6d1cd13

Please sign in to comment.