blob: c30083b1200605f1c7720d61ade4665ddfe957f3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
From 4460416abcb420588d189dd5bac6860c79b67ab5 Mon Sep 17 00:00:00 2001
From: Harald Hoyer <harald@redhat.com>
Date: Tue, 16 Apr 2013 13:33:40 +0200
Subject: [PATCH] lsinitrd.sh: do not output filename for a single file
---
lsinitrd.sh | 41 ++++++++++++++++++++++++++---------------
1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/lsinitrd.sh b/lsinitrd.sh
index 0481975..cd58529 100755
--- a/lsinitrd.sh
+++ b/lsinitrd.sh
@@ -119,23 +119,34 @@ case $bin in
;;
esac
-if (( ${#filenames[@]} > 0 )); then
- $CAT $image | cpio --extract --verbose --quiet --to-stdout ${!filenames[@]} 2>/dev/null
- exit $?
-fi
-
ret=0
-echo "$image: $(du -h $image | while read a b; do echo $a;done)"
-echo "========================================================================"
-$CAT "$image" | cpio --extract --verbose --quiet --to-stdout '*lib/dracut/dracut-*' 2>/dev/null
-((ret+=$?))
-echo "========================================================================"
-if [ "$sorted" -eq 1 ]; then
- $CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
+if (( ${#filenames[@]} > 0 )); then
+ (( ${#filenames[@]} == 1 )) && nofileinfo=1
+ for f in ${!filenames[@]}; do
+ [[ $nofileinfo ]] || echo "initramfs:/$f"
+ [[ $nofileinfo ]] || echo "========================================================================"
+ $CAT $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
+ ((ret+=$?))
+ [[ $nofileinfo ]] || echo "========================================================================"
+ [[ $nofileinfo ]] || echo
+ done
else
- $CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
+ echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
+ echo "========================================================================"
+ version=$($CAT "$image" | cpio --extract --verbose --quiet --to-stdout '*lib/dracut/dracut-*' 2>/dev/null)
+ ((ret+=$?))
+ echo "$version with dracut modules:"
+ $CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'usr/lib/dracut/modules.txt' 2>/dev/null
+ ((ret+=$?))
+ echo "========================================================================"
+ if [ "$sorted" -eq 1 ]; then
+ $CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
+ else
+ $CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
+ fi
+ ((ret+=$?))
+ echo "========================================================================"
fi
-((ret+=$?))
-echo "========================================================================"
+
exit $ret
|