Browse Source
Add lzma compression option for `MENDER_COMPRESS_DISK_IMAGE`.
It uses the parallel pxz compression tool.
Changelog: Title
Signed-off-by: Kristian Amlie <kristian.amlie@northern.tech>
2.0.x
Kristian Amlie
5 years ago
No known key found for this signature in database
GPG Key ID: F464407C996AF03F
3 changed files with
40 additions and
7 deletions
-
Dockerfile
-
configs/mender_convert_config
-
mender-convert-package
|
|
@ -1,3 +1,14 @@ |
|
|
|
# Build pxz in separate image to avoid big image size |
|
|
|
FROM ubuntu:19.04 AS build |
|
|
|
RUN apt-get update && apt-get install -y \ |
|
|
|
build-essential \ |
|
|
|
git \ |
|
|
|
liblzma-dev |
|
|
|
|
|
|
|
# Parallel xz (LZMA) compression |
|
|
|
RUN git clone https://github.com/jnovy/pxz.git /root/pxz |
|
|
|
RUN cd /root/pxz && make |
|
|
|
|
|
|
|
FROM ubuntu:19.04 |
|
|
|
|
|
|
|
ARG MENDER_ARTIFACT_VERSION=3.1.0 |
|
|
@ -30,7 +41,11 @@ RUN apt-get update && apt-get install -y \ |
|
|
|
# to get rid of 'sh: 1: udevadm: not found' errors triggered by parted |
|
|
|
udev \ |
|
|
|
# to create bmap index file (MENDER_USE_BMAP) |
|
|
|
bmap-tools |
|
|
|
bmap-tools \ |
|
|
|
# needed to run pxz |
|
|
|
libgomp1 |
|
|
|
|
|
|
|
COPY --from=build /root/pxz/pxz /usr/bin/pxz |
|
|
|
|
|
|
|
RUN wget -q -O /usr/bin/mender-artifact https://d1b0l86ne08fsf.cloudfront.net/mender-artifact/$MENDER_ARTIFACT_VERSION/linux/mender-artifact \ |
|
|
|
&& chmod +x /usr/bin/mender-artifact |
|
|
|
|
|
@ -4,12 +4,18 @@ |
|
|
|
# |
|
|
|
# NOTE! This file will always be sourced. |
|
|
|
|
|
|
|
# Compress generated disk image using gzip |
|
|
|
# Compress generated disk image |
|
|
|
# |
|
|
|
# This is useful when you have large disk images, compressing them |
|
|
|
# makes it easier to transfer them between e.g an build server and a local |
|
|
|
# machine, and obviously saves space. |
|
|
|
MENDER_COMPRESS_DISK_IMAGE=y |
|
|
|
# |
|
|
|
# Possible values are: |
|
|
|
# 'n' - No compression |
|
|
|
# 'gzip' - Compress with gzip |
|
|
|
# 'lzma' - Compress with xz (LZMA) |
|
|
|
# 'y' - Alias for 'gzip' |
|
|
|
MENDER_COMPRESS_DISK_IMAGE=gzip |
|
|
|
|
|
|
|
# Compression algorithm for Mender Artifact |
|
|
|
# |
|
|
|
|
|
@ -251,10 +251,22 @@ if [ "${MENDER_USE_BMAP}" == "y" ]; then |
|
|
|
run_and_log_cmd "${BMAP_TOOL} create ${sdimg_path} > ${sdimg_path}.bmap" |
|
|
|
fi |
|
|
|
|
|
|
|
if [ "${MENDER_COMPRESS_DISK_IMAGE}" == "y" ]; then |
|
|
|
log_info "Compressing ${sdimg_path}.gz" |
|
|
|
run_and_log_cmd "pigz --best --force ${sdimg_path}" |
|
|
|
fi |
|
|
|
case "${MENDER_COMPRESS_DISK_IMAGE}" in |
|
|
|
y | gzip) |
|
|
|
log_info "Compressing ${sdimg_path}.gz" |
|
|
|
run_and_log_cmd "pigz --best --force ${sdimg_path}" |
|
|
|
;; |
|
|
|
lzma) |
|
|
|
log_info "Compressing ${sdimg_path}.xz" |
|
|
|
run_and_log_cmd "pxz --best --force ${sdimg_path}" |
|
|
|
;; |
|
|
|
n) |
|
|
|
: |
|
|
|
;; |
|
|
|
*) |
|
|
|
log_fatal "Unknown MENDER_COMPRESS_DISK_IMAGE value: ${MENDER_COMPRESS_DISK_IMAGE}" |
|
|
|
;; |
|
|
|
esac |
|
|
|
|
|
|
|
log_info "Conversion has completed! \o/" |
|
|
|
|
|
|
|