summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiancarlo Razzolini <grazzolini@archlinux.org>2019-10-04 19:38:41 +0200
committerGiancarlo Razzolini <grazzolini@archlinux.org>2019-10-04 19:38:41 +0200
commit1dde014bf78f075ecea96a880aeaa68ec8f13268 (patch)
tree353754811f8a87dcf7d1d2a6aca9a9ac97a7e25c
parentb43739e39d9287baaec131f176a350736bffda4d (diff)
parent814dd9df251267c2e48d4a30bb3a192329e7f2ab (diff)
downloadmkinitcpio-1dde014bf78f075ecea96a880aeaa68ec8f13268.tar.gz
mkinitcpio-1dde014bf78f075ecea96a880aeaa68ec8f13268.tar.xz
Merge branch 'master' of https://github.com/falconindy/mkinitcpio into falconindy-master
-rwxr-xr-xmkinitcpio28
1 files changed, 13 insertions, 15 deletions
diff --git a/mkinitcpio b/mkinitcpio
index 9d4357e..06c5673 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -194,8 +194,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)
@@ -218,25 +217,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."