Moved to using "set -eo pipefail"
Change-Id: Ie73862997436c79be2b419bb913603581b6847cd
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/generate-squashfs b/generate-squashfs
index 0eff0ce..14515e4 100755
--- a/generate-squashfs
+++ b/generate-squashfs
@@ -1,4 +1,5 @@
#!/bin/bash
+set -eo pipefail
help=$'Generate SquashFS image Script
@@ -42,14 +43,13 @@
exit 1
fi
-scratch_dir=`mktemp -d` || exit 1
+scratch_dir=`mktemp -d`
echo "Parsing PNOR TOC..."
# Needed to get the READONLY and PRESERVED flags
# TODO: Get READONLY and PRESERVED flags from pflash instead.
-pflash_cmd="pflash --partition=part --read=${scratch_dir}/part -F ${pnorfile}"
-${pflash_cmd} || exit 1
+pflash --partition=part --read=${scratch_dir}/part -F ${pnorfile}
{
while read line; do
@@ -86,16 +86,15 @@
for partition in "${partitions[@]}"; do
echo "Reading ${partition}..."
- pflash_cmd="pflash --partition=${partition} --read=${scratch_dir}/${partition}
- -F ${pnorfile}"
- ${pflash_cmd} || exit 1
+ pflash --partition=${partition} \
+ --read=${scratch_dir}/${partition} \
+ -F ${pnorfile}
done
echo "Creating SquashFS image..."
cd "${scratch_dir}"
-squashfs_cmd="mksquashfs ${tocfile} ${partitions[*]} ${outfile}"
-${squashfs_cmd} || exit 1
+mksquashfs ${tocfile} ${partitions[*]} ${outfile}
echo "SquashFS Image at ${outfile}"
rm -r "${scratch_dir}"