Blame SOURCES/0150-dracut-initramfs-restore-fix-unpacking-with-early-mi.patch

966cef
From 0573e86a95374ce5e8816b1771634db049c70a3f Mon Sep 17 00:00:00 2001
966cef
From: Harald Hoyer <harald@redhat.com>
966cef
Date: Thu, 20 Mar 2014 13:18:13 +0100
966cef
Subject: [PATCH] dracut-initramfs-restore: fix unpacking with early microcode
966cef
966cef
(cherry picked from commit 0626cbe923732d45739ea6da4b816c78c44503ef)
966cef
---
966cef
 dracut-initramfs-restore.sh | 10 +++++++---
966cef
 1 file changed, 7 insertions(+), 3 deletions(-)
966cef
966cef
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
966cef
index f29c814..0dd1938 100644
966cef
--- a/dracut-initramfs-restore.sh
966cef
+++ b/dracut-initramfs-restore.sh
966cef
@@ -6,6 +6,10 @@ set -e
966cef
 
966cef
 KERNEL_VERSION="$(uname -r)"
966cef
 
966cef
+[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
966cef
+SKIP="$dracutbasedir/skipcpio"
966cef
+[[ -x $SKIP ]] || SKIP=cat
966cef
+
966cef
 [[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
966cef
 
966cef
 if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
966cef
@@ -16,11 +20,11 @@ fi
966cef
 cd /run/initramfs
966cef
 
966cef
 [ -f .need_shutdown -a -f "$IMG" ] || exit 1
966cef
-if zcat "$IMG"  | cpio -id --quiet >/dev/null; then
966cef
+if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
966cef
     rm -f -- .need_shutdown
966cef
-elif xzcat "$IMG"  | cpio -id --quiet >/dev/null; then
966cef
+elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
966cef
     rm -f -- .need_shutdown
966cef
-elif lz4 -d -c "$IMG"  | cpio -id --quiet >/dev/null; then
966cef
+elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
966cef
     rm -f -- .need_shutdown
966cef
 else
966cef
     # something failed, so we clean up