diff options
-rwxr-xr-x | mkinitramfs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/mkinitramfs b/mkinitramfs index 70ff0fe..0aa2ba7 100755 --- a/mkinitramfs +++ b/mkinitramfs @@ -266,7 +266,24 @@ if [ -e "${CONFDIR}/DSDT.aml" ]; then fi [ "${verbose}" = y ] && echo "Building cpio ${outfile} initramfs" -(cd "${DESTDIR}" && find . | cpio --quiet --dereference -o -H newc | gzip >"${outfile}") || exit 1 +( +# work around lack of "set -o pipefail" for the following pipe: +# cd "${DESTDIR}" && find . | cpio --quiet --dereference -o -H newc | gzip >"${outfile}" +exec 3>&1 +eval ` + # http://cfaj.freeshell.org/shell/cus-faq-2.html + exec 4>&1 >&3 3>&- + { + cd "${DESTDIR}" && find . 4>&-; echo "ec1=$?;" >&4 + } | { + cpio --quiet --dereference -o -H newc 4>&-; echo "ec2=$?;" >&4 + } | gzip >"${outfile}" + echo "ec3=$?;" >&4 +` +if [ "$ec1" -ne 0 ]; then exit "$ec1"; fi +if [ "$ec2" -ne 0 ]; then exit "$ec2"; fi +if [ "$ec3" -ne 0 ]; then exit "$ec3"; fi +) || exit $? if [ -s "${__TMPCPIOGZ}" ]; then cat "${__TMPCPIOGZ}" >>"${outfile}" || exit 1 |