lsinitrd.sh: prevent < <$() construct

Running dracut in a chroot environment, which has /dev not correctly
setup will result in errors like:

/usr/bin/lsinitrd: line 164: /dev/fd/62: No such file or directory
cpio: Malformed number �5�OK��
cpio: Malformed number 5�OK��
cpio: Malformed number �OK��

This is because bash wants /dev/fd/<num> for constructs like:
foo < <$(bar)
master
Harald Hoyer 2014-03-27 09:27:53 +01:00
parent 2c7f7a337a
commit fd9f902477
1 changed files with 29 additions and 21 deletions

View File

@ -160,27 +160,35 @@ case $bin in
;; ;;
esac esac


if [[ $SKIP ]]; then CAT=$({
read -N 6 bin < <($SKIP "$image") if [[ $SKIP ]]; then
fi $SKIP "$image"

else
case $bin in cat "$image"
$'\x1f\x8b'*) fi } | {
CAT="zcat --";; read -N 6 bin
BZh*) case $bin in
CAT="bzcat --";; $'\x1f\x8b'*)
$'\x71\xc7'*|070701) echo "zcat --"
CAT="cat --" ;;
;; BZh*)
$'\x02\x21'*) echo "bzcat --"
CAT="lz4 -d -c";; ;;
*) $'\x71\xc7'*|070701)
CAT="xzcat --"; echo "cat --"
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then ;;
CAT="xzcat --single-stream --" $'\x02\x21'*)
fi echo "lz4 -d -c"
;; ;;
esac *)
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
echo "xzcat --single-stream --"
else
echo "xzcat --"
fi
;;
esac
})


skipcpio() skipcpio()
{ {