process-debuginfo.in: rewrite module (de)compression logic

This change makes easier to add support of zstd-compressed modules in
the next commit.
This commit is contained in:
Gleb Fotengauer-Malinovskiy 2021-11-03 01:50:11 +03:00
parent f852e0e407
commit b07d68eab5

View File

@ -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