Blame SOURCES/rear-bz2096900.patch

5d051d
commit 389e5026df575ad98695191044257cf2b33d565b
5d051d
Author: pcahyna <pcahyna@users.noreply.github.com>
5d051d
Date:   Mon Jul 4 15:48:43 2022 +0200
5d051d
5d051d
    Merge pull request #2825 from lzaoral/replace-mkinitrd-with-dracut
5d051d
    
5d051d
    Replace `mkinitrd` with `dracut` on Fedora and RHEL
5d051d
5d051d
diff --git a/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh b/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh
5d051d
index 3476b77f..f296e624 100644
5d051d
--- a/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh
5d051d
+++ b/usr/share/rear/finalize/Fedora/i386/550_rebuild_initramfs.sh
5d051d
@@ -61,7 +61,7 @@ NEW_INITRD_MODULES=( $(tr " " "\n" <<< "${NEW_INITRD_MODULES[*]}" | sort | uniq
5d051d
 Log "New INITRD_MODULES='${OLD_INITRD_MODULES[@]} ${NEW_INITRD_MODULES[@]}'"
5d051d
 INITRD_MODULES="${OLD_INITRD_MODULES[@]} ${NEW_INITRD_MODULES[@]}"
5d051d
 
5d051d
-WITH_INITRD_MODULES=$( printf '%s\n' ${INITRD_MODULES[@]} | awk '{printf "--with=%s ", $1}' )
5d051d
+WITH_INITRD_MODULES=$( printf '%s\n' ${INITRD_MODULES[@]} | awk '{printf "--add-drivers=%s ", $1}' )
5d051d
 
5d051d
 # Recreate any initrd or initramfs image under $TARGET_FS_ROOT/boot/ with new drivers
5d051d
 # Images ignored:
5d051d
@@ -76,19 +76,19 @@ for INITRD_IMG in $( ls $TARGET_FS_ROOT/boot/initramfs-*.img $TARGET_FS_ROOT/boo
5d051d
     # Do not use KERNEL_VERSION here because that is readonly in the rear main script:
5d051d
     kernel_version=$( basename $( echo $INITRD_IMG ) | cut -f2- -d"-" | sed s/"\.img"// )
5d051d
     INITRD=$( echo $INITRD_IMG | egrep -o "/boot/.*" )
5d051d
-    LogPrint "Running mkinitrd..."
5d051d
-    # Run mkinitrd directly in chroot without a login shell in between (see https://github.com/rear/rear/issues/862).
5d051d
-    # We need the mkinitrd binary in the chroot environment i.e. the mkinitrd binary in the recreated system.
5d051d
-    # Normally we would use a login shell like: chroot $TARGET_FS_ROOT /bin/bash --login -c 'type -P mkinitrd'
5d051d
+    LogPrint "Running dracut..."
5d051d
+    # Run dracut directly in chroot without a login shell in between (see https://github.com/rear/rear/issues/862).
5d051d
+    # We need the dracut binary in the chroot environment i.e. the dracut binary in the recreated system.
5d051d
+    # Normally we would use a login shell like: chroot $TARGET_FS_ROOT /bin/bash --login -c 'type -P dracut'
5d051d
     # because otherwise there is no useful PATH (PATH is only /bin) so that 'type -P' won't find it
5d051d
     # but we cannot use a login shell because that contradicts https://github.com/rear/rear/issues/862
5d051d
     # so that we use a plain (non-login) shell and set a (hopefully) reasonable PATH:
5d051d
-    local mkinitrd_binary=$( chroot $TARGET_FS_ROOT /bin/bash -c 'PATH=/sbin:/usr/sbin:/usr/bin:/bin type -P mkinitrd' )
5d051d
-    # If there is no mkinitrd in the chroot environment plain 'chroot $TARGET_FS_ROOT' will hang up endlessly
5d051d
+    local dracut_binary=$( chroot $TARGET_FS_ROOT /bin/bash -c 'PATH=/sbin:/usr/sbin:/usr/bin:/bin type -P dracut' )
5d051d
+    # If there is no dracut in the chroot environment plain 'chroot $TARGET_FS_ROOT' will hang up endlessly
5d051d
     # and then "rear recover" cannot be aborted with the usual [Ctrl]+[C] keys.
5d051d
     # Use plain $var because when var contains only blanks test "$var" results true because test " " results true:
5d051d
-    if test $mkinitrd_binary ; then
5d051d
-        if chroot $TARGET_FS_ROOT $mkinitrd_binary -v -f ${WITH_INITRD_MODULES[@]} $INITRD $kernel_version >&2 ; then
5d051d
+    if test $dracut_binary ; then
5d051d
+        if chroot $TARGET_FS_ROOT $dracut_binary -v -f ${WITH_INITRD_MODULES[@]} $INITRD $kernel_version >&2 ; then
5d051d
             LogPrint "Updated initrd with new drivers for kernel $kernel_version."
5d051d
         else
5d051d
             LogPrint "WARNING:
5d051d
@@ -99,7 +99,7 @@ and decide yourself, whether the system will boot or not.
5d051d
         fi
5d051d
     else
5d051d
         LogPrint "WARNING:
5d051d
-Cannot create initrd (found no mkinitrd in the recreated system).
5d051d
+Cannot create initrd (found no dracut in the recreated system).
5d051d
 Check the recreated system (mounted at $TARGET_FS_ROOT)
5d051d
 and decide yourself, whether the system will boot or not.
5d051d
 "