Harald Hoyer d9da66
From bce6823a19b3fc0be50ff5c29c5ef90fa58b3430 Mon Sep 17 00:00:00 2001
Harald Hoyer d9da66
From: Harald Hoyer <harald@redhat.com>
Harald Hoyer d9da66
Date: Tue, 16 Jan 2018 12:14:15 +0100
Harald Hoyer d9da66
Subject: [PATCH] lsinitrd: no more cat: write error: Broken pipe
Harald Hoyer d9da66
Harald Hoyer d9da66
silence the cat
Harald Hoyer d9da66
---
Harald Hoyer d9da66
 lsinitrd.sh | 8 ++++----
Harald Hoyer d9da66
 1 file changed, 4 insertions(+), 4 deletions(-)
Harald Hoyer d9da66
Harald Hoyer d9da66
diff --git a/lsinitrd.sh b/lsinitrd.sh
Harald Hoyer d9da66
index f4088453..4892704a 100755
Harald Hoyer d9da66
--- a/lsinitrd.sh
Harald Hoyer d9da66
+++ b/lsinitrd.sh
Harald Hoyer d9da66
@@ -130,7 +130,7 @@ extract_files()
Harald Hoyer d9da66
     for f in "${!filenames[@]}"; do
Harald Hoyer d9da66
         [[ $nofileinfo ]] || echo "initramfs:/$f"
Harald Hoyer d9da66
         [[ $nofileinfo ]] || echo "========================================================================"
Harald Hoyer d9da66
-        $CAT $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
Harald Hoyer d9da66
+        $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
Harald Hoyer d9da66
         ((ret+=$?))
Harald Hoyer d9da66
         [[ $nofileinfo ]] || echo "========================================================================"
Harald Hoyer d9da66
         [[ $nofileinfo ]] || echo
Harald Hoyer d9da66
@@ -149,9 +149,9 @@ list_files()
Harald Hoyer d9da66
 {
Harald Hoyer d9da66
     echo "========================================================================"
Harald Hoyer d9da66
     if [ "$sorted" -eq 1 ]; then
Harald Hoyer d9da66
-        $CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
Harald Hoyer d9da66
+        $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -n -k5
Harald Hoyer d9da66
     else
Harald Hoyer d9da66
-        $CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
Harald Hoyer d9da66
+        $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --list | sort -k9
Harald Hoyer d9da66
     fi
Harald Hoyer d9da66
     ((ret+=$?))
Harald Hoyer d9da66
     echo "========================================================================"
Harald Hoyer d9da66
@@ -159,7 +159,7 @@ list_files()
Harald Hoyer d9da66
 
Harald Hoyer d9da66
 unpack_files()
Harald Hoyer d9da66
 {
Harald Hoyer d9da66
-    $CAT "$image" | cpio -id --quiet $verbose
Harald Hoyer d9da66
+    $CAT "$image" 2>/dev/null | cpio -id --quiet $verbose
Harald Hoyer d9da66
     ((ret+=$?))
Harald Hoyer d9da66
 }
Harald Hoyer d9da66
 
Harald Hoyer d9da66