From b07d68eab50a82a2fc52605c4de14028175a8c45 Mon Sep 17 00:00:00 2001 From: Gleb Fotengauer-Malinovskiy Date: Wed, 3 Nov 2021 01:50:11 +0300 Subject: [PATCH] process-debuginfo.in: rewrite module (de)compression logic This change makes easier to add support of zstd-compressed modules in the next commit. --- scripts/process-debuginfo.in | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/scripts/process-debuginfo.in b/scripts/process-debuginfo.in index 71c27a7..2bcc68b 100755 --- a/scripts/process-debuginfo.in +++ b/scripts/process-debuginfo.in @@ -23,12 +23,23 @@ strip_rel= if [ -z "${f#./lib/modules/*.ko}" ]; then elfcompress=yes strip_rel="--reloc-debug-sections" -elif [ -z "${f#./lib/modules/*.ko.[gx]z}" ]; then - rezip=${f##*.} - rezip=${rezip/gz/gzip} +elif [ -z "${f##./lib/modules/*.ko.*}" ]; then + ext=${f##*.} + unzip= + rezip= + case "$ext" in + gz) + unzip='gzip --force --decompress' + rezip='gzip --force --keep' + ;; + xz) + unzip='xz --force --decompress' + rezip='xz --force --keep' + ;; + esac # Compressed module: uncompress it, and work with uncompressed one. - $rezip --decompress --force "$f" - f=${f%.[gx]z} + $unzip "$f" + f="${f%.*}" elfcompress=yes strip_rel="--reloc-debug-sections" elif [ -z "${f##./boot/vmlinuz-*}" ]; then