From 3e18e3d923f0353ceb9a407b63f16222d609b5ee Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sat, 22 Dec 2012 11:50:47 -0500 Subject: lsinitcpio: fail hard if the image can't be extracted Signed-off-by: Dave Reisner --- lsinitcpio | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lsinitcpio b/lsinitcpio index a31733d..f594fdc 100755 --- a/lsinitcpio +++ b/lsinitcpio @@ -81,7 +81,7 @@ analyze_image() { zsize=$(stat -c %s "$_image") # calculate compression ratio - TIMEFORMAT=%R decomptime=$({ time decomp "$_image" >/dev/null; } 2>&1 ) + TIMEFORMAT=%R decomptime=$({ time decomp "$_image" >/dev/null; } 2>&1) if [[ $_compress ]]; then fullsize=$(decomp "$_image" | bsdtar xOf - | wc -c) ratio=.$(( zsize * 1000 / fullsize % 1000 )) @@ -90,7 +90,9 @@ analyze_image() { # decompress the image since we need to read from it multiple times. we # have to pass this through decomp() since the image might be lzop which # bsdtar can't read. - decomp "$_image" | bsdtar -C "$workdir" -xf - + if ! decomp "$_image" | bsdtar -C "$workdir" -xf -; then + die 'Failed to decompress image' + fi # collect stats kernver=("$workdir"/usr/lib/modules/*/) -- cgit v1.2.3-24-g4f1b