mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 20:47:55 +00:00
Merge pull request #1860 from tlaurion/fix_initrd_unpack_for_repacking
initrd/bin/unpack_initramfs.sh: add xz unpacking support.
This commit is contained in:
commit
45696a4c8a
@ -45,7 +45,10 @@ consume_zeros() {
|
|||||||
|
|
||||||
unpack_cpio() {
|
unpack_cpio() {
|
||||||
TRACE_FUNC
|
TRACE_FUNC
|
||||||
(cd "$dest_dir"; cpio -i "${CPIO_ARGS[@]}" 2>/dev/null)
|
(
|
||||||
|
cd "$dest_dir"
|
||||||
|
cpio -i "${CPIO_ARGS[@]}" 2>/dev/null
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
# unpack the first segment of an archive, then write the rest to another file
|
# unpack the first segment of an archive, then write the rest to another file
|
||||||
@ -87,6 +90,10 @@ unpack_first_segment() {
|
|||||||
# walking all the compressed blocks.
|
# walking all the compressed blocks.
|
||||||
gunzip | unpack_cpio
|
gunzip | unpack_cpio
|
||||||
;;
|
;;
|
||||||
|
fd37*) # xz
|
||||||
|
DEBUG "archive segment $magic: xz"
|
||||||
|
unxz | unpack_cpio
|
||||||
|
;;
|
||||||
28b5*) # zstd
|
28b5*) # zstd
|
||||||
DEBUG "archive segment $magic: zstd"
|
DEBUG "archive segment $magic: zstd"
|
||||||
# Like gunzip, this will not stop when reaching the end of the
|
# Like gunzip, this will not stop when reaching the end of the
|
||||||
@ -96,6 +103,26 @@ unpack_first_segment() {
|
|||||||
;;
|
;;
|
||||||
*) # unknown
|
*) # unknown
|
||||||
die "Can't decompress initramfs archive, unknown type: $magic"
|
die "Can't decompress initramfs archive, unknown type: $magic"
|
||||||
|
# The following are magic values for other compression formats
|
||||||
|
# but not added because not tested.
|
||||||
|
# TODO: open an issue for unsupported magic number reported on die.
|
||||||
|
#
|
||||||
|
#425a*) # bzip2
|
||||||
|
# DEBUG "archive segment $magic: bzip2"
|
||||||
|
# bunzip2 | unpack_cpio
|
||||||
|
#;;
|
||||||
|
#5d00*) # lzma
|
||||||
|
# DEBUG "archive segment $magic: lzma"
|
||||||
|
# unlzma | unpack_cpio
|
||||||
|
#;;
|
||||||
|
#894c*) # lzo
|
||||||
|
# DEBUG "archive segment $magic: lzo"
|
||||||
|
# lzop -d | unpack_cpio
|
||||||
|
#;;
|
||||||
|
#0221*) # lz4
|
||||||
|
# DEBUG "archive segment $magic: lz4"
|
||||||
|
# lz4 -d | unpack_cpio
|
||||||
|
# ;;
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
) <"$unpack_archive" >"$rest_archive"
|
) <"$unpack_archive" >"$rest_archive"
|
||||||
|
Loading…
Reference in New Issue
Block a user