Merge pull request #2863 from flatcar/chewi/extract-vmlinuz-mkdir

build_library: Fix extraction script and sort content listings
This commit is contained in:
James Le Cuirot 2025-05-08 08:04:40 +01:00 committed by GitHub
commit b10387a933
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View File

@ -29,8 +29,12 @@ try_extract() {
# cpio can do strange things when given garbage, so do a basic check.
[[ $(head -c6 "$1") == 070701 ]] || return 0
# There may be multiple concatenated archives so try cpio till it fails.
while cpio --quiet --extract --make-directories --directory="${out}/rootfs-${ROOTFS_IDX}" --nonmatching 'dev/*' 2>/dev/null; do
while {
# cpio needs the directory to exist first. Fail if it's already there.
{ mkdir "${out}/rootfs-${ROOTFS_IDX}" || return $?; } &&
# There may be multiple concatenated archives so try cpio till it fails.
cpio --quiet --extract --make-directories --directory="${out}/rootfs-${ROOTFS_IDX}" --nonmatching 'dev/*' 2>/dev/null
}; do
ROOTFS_IDX=$(( ROOTFS_IDX + 1 ))
done < "$1"
@ -49,7 +53,7 @@ if [[ ! -s "${image}" ]]; then
fi
mkdir -p "${out}"
tmp=$(mktemp --directory eifv-XXXXXX)
tmp=$(mktemp --directory -t eifv-XXXXXX)
trap 'rm -rf -- "${tmp}"' EXIT
ROOTFS_IDX=0

View File

@ -33,6 +33,7 @@ write_contents() {
# %l - symlink target (empty if not a symlink)
sudo TZ=UTC find -printf \
'%M %2n %-7u %-7g %7s %TY-%Tm-%Td %TH:%TM ./%P -> %l\n' \
| sort --key=8 \
| sed -e 's/ -> $//' >"${output}"
popd >/dev/null
}
@ -57,7 +58,8 @@ write_contents_with_technical_details() {
# %s - size in bytes
# %P - file's path
sudo find -printf \
'%M %D %i %n %s ./%P\n' >"${output}"
'%M %D %i %n %s ./%P\n' \
| sort --key=6 >"${output}"
popd >/dev/null
}