Blame SOURCES/rear-bz2096900.patch

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