From 7e4632dbc45d4a466ec29d49d96e5a7894046979 Mon Sep 17 00:00:00 2001 From: Dell Green Date: Mon, 13 Feb 2023 22:18:37 +0000 Subject: [PATCH] fix: support mender deb package data archive zstandard compression Newer upstream mender-client deb packages are using zstd compression for the data tar archive. Up until now there was only support for xz compression. Added additional support so that the data archive can be either xz or zstd compressed. Changelog: support added for mender-client deb package data archive compressed with zstd Ticket: MEN-6307 Signed-off-by: Dell Green Signed-off-by: Kristian Amlie --- Dockerfile | 1 + modules/deb.sh | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 23200db..d774a99 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,7 @@ RUN apt-get update && env DEBIAN_FRONTEND=noninteractive apt-get install -y \ # For 'ar' command to unpack .deb binutils \ xz-utils \ + zstd \ # to be able to detect file system types of extracted images file \ # to copy files between rootfs directories diff --git a/modules/deb.sh b/modules/deb.sh index 7fc7557..9b9dc3e 100644 --- a/modules/deb.sh +++ b/modules/deb.sh @@ -1,4 +1,4 @@ -# Copyright 2022 Northern.tech AS +# Copyright 2023 Northern.tech AS # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -111,7 +111,10 @@ function deb_extract_package() { cd ${extract_dir} run_and_log_cmd "ar -xv ${deb_package}" mkdir -p files - run_and_log_cmd "sudo tar xJf data.tar.xz -C files" + + local -r data_archive=$(find . -maxdepth 1 -type f -regex '.*/data\.tar\.\(zst\|xz\)' -printf '%P\n' -quit) + run_and_log_cmd "sudo tar xf ${data_archive} -C files" + cd - > /dev/null 2>&1 run_and_log_cmd "sudo rsync --archive --keep-dirlinks --verbose ${extract_dir}/files/ ${dest_dir}"