summaryrefslogtreecommitdiff
path: root/lsinitramfs
diff options
context:
space:
mode:
Diffstat (limited to 'lsinitramfs')
-rwxr-xr-xlsinitramfs22
1 files changed, 17 insertions, 5 deletions
diff --git a/lsinitramfs b/lsinitramfs
index aea7747..809445f 100755
--- a/lsinitramfs
+++ b/lsinitramfs
@@ -3,12 +3,24 @@
usage()
{
echo "Usage: $(basename $0) <initramfs file>"
- exit 1
}
-[ $# -eq 0 ] && usage
+if [ "$#" -eq 0 ] ; then
+ usage >&2
+ exit 1
+fi
+
+if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
+ usage
+ exit 0
+fi
-for i in $*; do
- echo $i
- zcat $i | cpio --extract --verbose --quiet --list
+for i in "$*" ; do
+ if ! [ -r "$i" ] ; then
+ echo "Specified file could not be read." >&2
+ exit 1
+ else
+ echo "$i"
+ zcat "$i" | cpio --extract --verbose --quiet --list
+ fi
done