summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-05-26 23:19:29 +0200
committerDave Reisner <dreisner@archlinux.org>2012-06-01 15:37:16 +0200
commit015d482ce8394acd2f8bc9da2cd70339ebbcc3f9 (patch)
treedbd06ea7794faa72e27d199e3db973c9a1c66097
parent9a20048c6279cd5a037108980069bb46b4a6299d (diff)
downloadmkinitcpio-015d482ce8394acd2f8bc9da2cd70339ebbcc3f9.tar.gz
mkinitcpio-015d482ce8394acd2f8bc9da2cd70339ebbcc3f9.tar.xz
avoid subshell in adding --quiet to bsdcpio
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rwxr-xr-xmkinitcpio17
1 files changed, 13 insertions, 4 deletions
diff --git a/mkinitcpio b/mkinitcpio
index eae27fe..8762991 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -389,18 +389,27 @@ set +o functrace
trap -- ERR
declare -i status=0
-declare -a pipesave
if [[ $GENIMG ]]; then
msg "Creating $COMPRESSION initcpio image: %s" "$GENIMG"
- [[ $COMPRESSION = xz ]] && COMPRESSION_OPTIONS+=" --check=crc32"
+
+ case $COMPRESSION in
+ xz)
+ COMPRESSION_OPTIONS+=' --check=crc32'
+ ;;
+ esac
+
+ cpio_opts=('-R' '0:0' '-0' '-o' '-H' 'newc')
+ if (( QUIET )); then
+ cpio_opts+=('--quiet')
+ fi
# write version stamp
printf '%s' "$version" > "$BUILDROOT/VERSION"
pushd "$BUILDROOT" >/dev/null
find . -print0 |
- bsdcpio $( (( QUIET )) && echo '--quiet' ) -R 0:0 -0oH newc |
- $COMPRESSION $COMPRESSION_OPTIONS > "$GENIMG"
+ bsdcpio "${cpio_opts[@]}" |
+ $COMPRESSION $COMPRESSION_OPTIONS > "$GENIMG"
pipesave=("${PIPESTATUS[@]}") # save immediately
popd >/dev/null