diff options
author | Jeremy Cline <jcline@redhat.com> | 2019-12-04 13:55:02 -0500 |
---|---|---|
committer | Jeremy Cline <jcline@redhat.com> | 2019-12-04 16:45:42 -0500 |
commit | cce01a3bcfec33e7e56b9cdcd5024a8d70f25d8e (patch) | |
tree | dce598ebab8c49f22bb85c5751e221f9daee57b7 /parallel_xz.sh | |
parent | 983730bdf1b2b5cae0e755b4c81bf96a9c3bc154 (diff) | |
download | kernel-cce01a3bcfec33e7e56b9cdcd5024a8d70f25d8e.tar.gz kernel-cce01a3bcfec33e7e56b9cdcd5024a8d70f25d8e.tar.xz kernel-cce01a3bcfec33e7e56b9cdcd5024a8d70f25d8e.zip |
Sync up specfile, config generation, and patches
Signed-off-by: Jeremy Cline <jcline@redhat.com>
Diffstat (limited to 'parallel_xz.sh')
-rwxr-xr-x | parallel_xz.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/parallel_xz.sh b/parallel_xz.sh new file mode 100755 index 000000000..bc08a548d --- /dev/null +++ b/parallel_xz.sh @@ -0,0 +1,26 @@ +#!/bin/sh +# Reads filenames on stdin, xz-compresses each in place. +# Not optimal for "compress relatively few, large files" scenario! + +# How many xz's to run in parallel: +procgroup="" +while test "$#" != 0; do + # Get it from -jNUM + N="${1#-j}" + if test "$N" = "$1"; then + # Not -j<something> - warn and ignore + echo "parallel_xz: warning: unrecognized argument: '$1'" + else + procgroup="$N" + fi + shift +done + +# If told to use only one cpu: +test "$procgroup" || exec xargs -r xz +test "$procgroup" = 1 && exec xargs -r xz + +# xz has some startup cost. If files are really small, +# this cost might be significant. To combat this, +# process several files (in sequence) by each xz process via -n 16: +exec xargs -r -n 16 -P $procgroup xz |