Explicitly set number of xz compressor threads

This commit is contained in:
Michael Aldridge
2017-08-21 00:04:17 -07:00
parent 5791d18d31
commit 4f514f5212
4 changed files with 18 additions and 11 deletions

View File

@@ -61,6 +61,7 @@ Options
-C <file> Full path to the XBPS configuration file
-h Show this help
-r <repo> Set XBPS repository (may be set multiple times)
-x <num> Use <num> threads to compress the image (dynamic if unset)
-V Show version
_EOF
}
@@ -71,12 +72,13 @@ _EOF
# Boilerplate option parsing. This script supports the bare minimum
# needed to build an image.
while getopts "C:c:h:r:V" opt; do
while getopts "C:c:h:r:x:V" opt; do
case $opt in
C) XBPS_CONFFILE="-C $OPTARG";;
c) XBPS_CACHEDIR="--cachedir=$OPTARG";;
h) usage; exit 0;;
r) XBPS_REPOSITORY="$XBPS_REPOSITORY --repository=$OPTARG";;
x) COMPRESSOR_THREADS="$OPTARG" ;;
V) echo "$PROGNAME @@MKLIVE_VERSION@@"; exit 0;;
esac
done
@@ -205,7 +207,7 @@ rm -rf "$ROOTFS/var/cache/*" 2>/dev/null
# Finally we can compress the tarball, the name will include the
# architecture and the date on which the tarball was built.
tarball=void-${XBPS_TARGET_ARCH}-ROOTFS-$(date '+%Y%m%d').tar.xz
run_cmd "tar -cp --posix --xattrs -C $ROOTFS . | xz -T0 -9 > $tarball "
run_cmd "tar -cp --posix --xattrs -C $ROOTFS . | xz -T${COMPRESSOR_THREADS:-0} -9 > $tarball "
# Now that we have the tarball we don't need the rootfs anymore, so we
# can get rid of it.