Commit 3714d5b4 authored by Ben Hutchings's avatar Ben Hutchings

unmkinitramfs: Change mkdir/cd/cpio command sequences to exit on failure

Surprisingly, a command such as:

    false || { false && true; }

yields a return code of 1, but does not cause a shell with -e enabled
to exit (seen in bug #848423).

Rewrite these sequences using if statements, which seem to have the
right behaviour.
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 251adae0
......@@ -24,7 +24,10 @@ xcpio()
lzop -c -d "$archive"
# Ignoring other data, which may be garbage at the end of the file
fi | (
test -z "$dir" || { mkdir -p -- "$dir" && cd -- "$dir"; }
if [ -n "$dir" ]; then
mkdir -p -- "$dir"
cd -- "$dir"
fi
cpio "$@"
)
}
......@@ -72,7 +75,10 @@ splitinitramfs()
if [ $offset -ne 0 ]; then
# uncompressed archive
(
test -z "$dir" || { mkdir -p -- "$dir/early" && cd -- "$dir/early"; }
if [ -n "$dir" ]; then
mkdir -p -- "$dir/early"
cd -- "$dir/early"
fi
cpio -i "$@"
) < "$initramfs"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment