summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-12-22 17:50:47 +0100
committerDave Reisner <dreisner@archlinux.org>2013-01-12 20:31:28 +0100
commit3e18e3d923f0353ceb9a407b63f16222d609b5ee (patch)
treeb8a8f7298f95b7b8b3c8e3732ae829f1cc24b6a3
parentf8ee357b280161e7d3e04fdf9d3f73643ccfdddb (diff)
downloadmkinitcpio-3e18e3d923f0353ceb9a407b63f16222d609b5ee.tar.gz
mkinitcpio-3e18e3d923f0353ceb9a407b63f16222d609b5ee.tar.xz
lsinitcpio: fail hard if the image can't be extracted
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rwxr-xr-xlsinitcpio6
1 files 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/*/)