cpio: do not fail on ghost rootfs

On Linux >= 6.10, the first rootfs is an extra ghost rootfs of 336K,
that has a corrupted CPIO.

To overcome this issue, do not fail on `cpio --extract`.
This commit is contained in:
Adrian Vladu 2024-09-18 14:46:44 +00:00 committed by James Le Cuirot
parent 36005a4b08
commit 0a8267f69b
No known key found for this signature in database
GPG Key ID: 1226415D00DD3137

View File

@ -81,11 +81,9 @@ perform_round() {
for rnd in "${round_prefix}"*; do for rnd in "${round_prefix}"*; do
if [[ $(file --brief "${rnd}") =~ 'cpio archive' ]]; then if [[ $(file --brief "${rnd}") =~ 'cpio archive' ]]; then
mkdir -p "${out}/rootfs-${ROOTFS_IDX}" mkdir -p "${out}/rootfs-${ROOTFS_IDX}"
while cpio --quiet --extract --make-directories --directory="${out}/rootfs-${ROOTFS_IDX}" --nonmatching 'dev/*'; do # On Linux 6.10, the first rootfs is an extra ghost rootfs of 336K, that has a corrupted CPIO
cpio --quiet --extract --make-directories --directory="${out}/rootfs-${ROOTFS_IDX}" --nonmatching 'dev/*' < $rnd || true
ROOTFS_IDX=$(( ROOTFS_IDX + 1 )) ROOTFS_IDX=$(( ROOTFS_IDX + 1 ))
mkdir -p "${out}/rootfs-${ROOTFS_IDX}"
done <${rnd}
rmdir "${out}/rootfs-${ROOTFS_IDX}"
fi fi
done done
} }