File kernel-install.diff of Package dracut

Index: dracut-056+suse.275.g4ce7a6a7/install.d/50-dracut.install
===================================================================
--- dracut-056+suse.275.g4ce7a6a7.orig/install.d/50-dracut.install
+++ dracut-056+suse.275.g4ce7a6a7/install.d/50-dracut.install
@@ -23,6 +23,10 @@ case "$COMMAND" in
     add)
         INITRD_IMAGE_PREGENERATED=${KERNEL_IMAGE%/*}/initrd
         if [[ -f ${INITRD_IMAGE_PREGENERATED} ]]; then
+            if [ -n "$SNAPSHOT" ] && [ -e "$BOOT_DIR_ABS/$INITRD" ]; then
+                    echo "initrd already exists, not adding a new one for #$SNAPSHOT"
+                    exit 0
+            fi
             # we found an initrd at the same place as the kernel
             # use this and don't generate a new one
             cp --reflink=auto "$INITRD_IMAGE_PREGENERATED" "$BOOT_DIR_ABS/$INITRD" \
@@ -54,11 +58,16 @@ case "$COMMAND" in
                 break
             fi
         done
-	dracut -f ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
+        if [ -n "$SNAPSHOT" ] && [ -e "$BOOT_DIR_ABS/$INITRD" ]; then
+                echo "initrd already exists, not generating a new one for #$SNAPSHOT"
+                exit 0
+        fi
+        dracut -f ${noimageifnotneeded:+--noimageifnotneeded} "$BOOT_DIR_ABS/$INITRD" "$KERNEL_VERSION"
         ret=$?
 	;;
     remove)
-        rm -f -- "$BOOT_DIR_ABS/$INITRD"
+	# don't do that. kernel-install will remove BOOT_DIR_ABS if needed
+        #rm -f -- "$BOOT_DIR_ABS/$INITRD"
         ret=$?
 	;;
 esac
openSUSE Build Service is sponsored by