|
|
ab92d3 |
From 0c2ac6b7503661948ead031f745736e35fef2e3f Mon Sep 17 00:00:00 2001
|
|
|
ab92d3 |
From: Kairui Song <kasong@redhat.com>
|
|
|
ab92d3 |
Date: Wed, 26 Dec 2018 17:38:02 +0800
|
|
|
ab92d3 |
Subject: [PATCH] lsinitrd: list squash content as well
|
|
|
ab92d3 |
|
|
|
ab92d3 |
When the initramfs is built with squash module enabled, the content
|
|
|
ab92d3 |
inside squash image will be invisible from the lsinitrd tool. This
|
|
|
ab92d3 |
commit make lsinitrd detect and list the content of the squash image as
|
|
|
ab92d3 |
well to avoid possible confusion.
|
|
|
ab92d3 |
|
|
|
ab92d3 |
Signed-off-by: Kairui Song <kasong@redhat.com>
|
|
|
ab92d3 |
(cherry picked from commit 1ff306a3964840fc548188a8aa4862143b347e8a)
|
|
|
ab92d3 |
|
|
|
ab92d3 |
Resolves: #1959336
|
|
|
ab92d3 |
---
|
|
|
ab92d3 |
lsinitrd.sh | 16 ++++++++++++++++
|
|
|
ab92d3 |
1 file changed, 16 insertions(+)
|
|
|
ab92d3 |
|
|
|
ab92d3 |
diff --git a/lsinitrd.sh b/lsinitrd.sh
|
|
|
ab92d3 |
index a2fa4d7a..0b42b9a4 100755
|
|
|
ab92d3 |
--- a/lsinitrd.sh
|
|
|
ab92d3 |
+++ b/lsinitrd.sh
|
|
|
ab92d3 |
@@ -160,6 +160,21 @@ list_files()
|
|
|
ab92d3 |
echo "========================================================================"
|
|
|
ab92d3 |
}
|
|
|
ab92d3 |
|
|
|
ab92d3 |
+list_squash_content()
|
|
|
ab92d3 |
+{
|
|
|
ab92d3 |
+ SQUASH_IMG="squash/root.img"
|
|
|
ab92d3 |
+ SQUASH_TMPFILE="$(mktemp -t --suffix=.root.sqsh lsinitrd.XXXXXX)"
|
|
|
ab92d3 |
+ trap "rm -f '$SQUASH_TMPFILE'" EXIT
|
|
|
ab92d3 |
+ $CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- \
|
|
|
ab92d3 |
+ $SQUASH_IMG > "$SQUASH_TMPFILE" 2>/dev/null
|
|
|
ab92d3 |
+ if [[ -s $SQUASH_TMPFILE ]]; then
|
|
|
ab92d3 |
+ echo "Squashed content ($SQUASH_IMG):"
|
|
|
ab92d3 |
+ echo "========================================================================"
|
|
|
ab92d3 |
+ unsquashfs -ll "$SQUASH_TMPFILE" | tail -n +4
|
|
|
ab92d3 |
+ echo "========================================================================"
|
|
|
ab92d3 |
+ fi
|
|
|
ab92d3 |
+}
|
|
|
ab92d3 |
+
|
|
|
ab92d3 |
unpack_files()
|
|
|
ab92d3 |
{
|
|
|
ab92d3 |
if (( ${#filenames[@]} > 0 )); then
|
|
|
ab92d3 |
@@ -287,6 +302,7 @@ else
|
|
|
ab92d3 |
echo
|
|
|
ab92d3 |
list_modules
|
|
|
ab92d3 |
list_files
|
|
|
ab92d3 |
+ list_squash_content
|
|
|
ab92d3 |
fi
|
|
|
ab92d3 |
fi
|
|
|
ab92d3 |
|
|
|
ab92d3 |
|