Add detection support for zstd compressed initramfs, the magic number of zstd is defined as 0xFD2FB528.
https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md Signed-off-by: Jelle van der Waa <je...@vdwaa.nl> --- lsinitcpio | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lsinitcpio b/lsinitcpio index bcb4a19..d44a714 100755 --- a/lsinitcpio +++ b/lsinitcpio @@ -131,6 +131,12 @@ detect_filetype() { return fi + read -rd '' bytes < <(hexdump -n 4 -e '"%x"' "$1") + if [[ $bytes = 'fd2fb528' ]]; then + echo 'zstd' + return + fi + # still nothing? hrmm, maybe the user goofed and it's a kernel if kver "$1" >/dev/null; then die '%s is a kernel image, not an initramfs image!' "$1" -- 2.21.0