diff options
author | Dave Reisner <dreisner@archlinux.org> | 2019-09-15 14:10:36 +0200 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2019-09-17 00:33:18 +0200 |
commit | 814dd9df251267c2e48d4a30bb3a192329e7f2ab (patch) | |
tree | 61868a316190651ba7a22bf1c24719116c300f4d | |
parent | 74d5acfa3c33121ed119698080dbcfb79b21e881 (diff) | |
download | mkinitcpio-814dd9df251267c2e48d4a30bb3a192329e7f2ab.tar.gz mkinitcpio-814dd9df251267c2e48d4a30bb3a192329e7f2ab.tar.xz |
consolidate error reporting within generation pipeline
-rwxr-xr-x | mkinitcpio | 28 |
1 files changed, 13 insertions, 15 deletions
@@ -192,8 +192,7 @@ compute_hookset() { } build_image() { - local out=$1 compress=$2 errmsg= - local -a pipesave cpio_opts + local out=$1 compress=$2 errmsg pipestatus case $compress in cat) @@ -216,25 +215,24 @@ build_image() { # Reproducibility: set all timestamps to 0 find . -mindepth 1 -execdir touch -hcd "@0" "{}" + - find . -mindepth 1 -printf '%P\0' | sort -z | + # If this pipeline changes, |pipeprogs| below needs to be updated as well. + find . -mindepth 1 -printf '%P\0' | + sort -z | LANG=C bsdtar --null -cnf - -T - | LANG=C bsdtar --uid 0 --gid 0 --null -cf - --format=newc @- | $compress "${COMPRESSION_OPTIONS[@]}" > "$out" - pipesave=("${PIPESTATUS[@]}") # save immediately + pipestatus=("${PIPESTATUS[@]}") + pipeprogs=('find' 'sort' 'bsdtar (step 1)' 'bsdtar (step 2)' "$compress") + popd >/dev/null - if (( pipesave[0] )); then - errmsg="find reported an error" - elif (( pipesave[1] )); then - errmsg="sort reported an error" - elif (( pipesave[2] )); then - errmsg="bsdtar (step 1) reported an error" - elif (( pipesave[3] )); then - errmsg="bsdtar (step 2) reported an error" - elif (( pipesave[4] )); then - errmsg="$compress reported an error" - fi + for (( i = 0; i < ${#pipestatus[*]}; ++i )); do + if (( pipestatus[i] )); then + errmsg="${pipeprogs[i]} reported an error" + break + fi + done if (( _builderrors )); then warning "errors were encountered during the build. The image may not be complete." |