mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-07 21:16:57 +02:00
build_library: Fix directory handling in extraction script
I thought cpio was always creating the output directory automatically, but it was silently failing. It would only extract the next rootfs when run a subsequent time. Signed-off-by: James Le Cuirot <jlecuirot@microsoft.com>
This commit is contained in:
parent
9af775ba36
commit
ec904175e6
@ -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
|
||||
|
||||
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.
|
||||
while cpio --quiet --extract --make-directories --directory="${out}/rootfs-${ROOTFS_IDX}" --nonmatching 'dev/*' 2>/dev/null; do
|
||||
cpio --quiet --extract --make-directories --directory="${out}/rootfs-${ROOTFS_IDX}" --nonmatching 'dev/*' 2>/dev/null
|
||||
}; do
|
||||
ROOTFS_IDX=$(( ROOTFS_IDX + 1 ))
|
||||
done < "$1"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user