diff --git a/lsinitrd.sh b/lsinitrd.sh index 8dc90323..a697bc2b 100755 --- a/lsinitrd.sh +++ b/lsinitrd.sh @@ -160,27 +160,35 @@ case $bin in ;; esac -if [[ $SKIP ]]; then - read -N 6 bin < <($SKIP "$image") -fi - -case $bin in - $'\x1f\x8b'*) - CAT="zcat --";; - BZh*) - CAT="bzcat --";; - $'\x71\xc7'*|070701) - CAT="cat --" - ;; - $'\x02\x21'*) - CAT="lz4 -d -c";; - *) - CAT="xzcat --"; - if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then - CAT="xzcat --single-stream --" - fi - ;; -esac +CAT=$({ + if [[ $SKIP ]]; then + $SKIP "$image" + else + cat "$image" + fi } | { + read -N 6 bin + case $bin in + $'\x1f\x8b'*) + echo "zcat --" + ;; + BZh*) + echo "bzcat --" + ;; + $'\x71\xc7'*|070701) + echo "cat --" + ;; + $'\x02\x21'*) + echo "lz4 -d -c" + ;; + *) + if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then + echo "xzcat --single-stream --" + else + echo "xzcat --" + fi + ;; + esac + }) skipcpio() {