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