]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
lsinitrd: use xz with --single-stream, if available
authorHarald Hoyer <harald@redhat.com>
Mon, 23 Jan 2012 09:34:03 +0000 (10:34 +0100)
committerHarald Hoyer <harald@redhat.com>
Mon, 23 Jan 2012 09:35:26 +0000 (10:35 +0100)
The F16 installation image is two concatenated cpio images:
[xz-compressed dracut initramfs][uncompressed cpio with /squashfs.img]

So to show the contents, use xz with the "--single-stream" option.

https://bugzilla.redhat.com/show_bug.cgi?id=742299

lsinitrd

index ad7ece9f493d86d7d9d8590bb464fdddb62a0f27..1d953b758434ca76a73173ee2b9c96dbed95c88a 100755 (executable)
--- a/lsinitrd
+++ b/lsinitrd
@@ -36,12 +36,16 @@ image="${1:-/boot/initramfs-$(uname -r).img}"
 CAT=zcat
 FILE_T=$(file "$image")
 
+if echo "test"|xz|xz -dc --single-stream; then
+    XZ_SINGLE_STREAM="--single-stream"
+fi
+
 if [[ "$FILE_T" =~ ": gzip compressed data" ]]; then
     CAT=zcat
 elif [[ "$FILE_T" =~ ": xz compressed data" ]]; then
-    CAT=xzcat
+    CAT="xzcat $XZ_SINGLE_STREAM"
 elif [[ "$FILE_T" =~ ": XZ compressed data" ]]; then
-    CAT=xzcat
+    CAT="xzcat $XZ_SINGLE_STREAM"
 elif [[ "$FILE_T" =~ ": data" ]]; then
     CAT=lzcat
 fi