SOURCES: lesspipe.sh - display contents of compressed cpio initrd

glen glen at pld-linux.org
Wed Nov 7 01:05:18 CET 2007


Author: glen                         Date: Wed Nov  7 00:05:18 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- display contents of compressed cpio initrd

---- Files affected:
SOURCES:
   lesspipe.sh (1.25 -> 1.26) 

---- Diffs:

================================================================
Index: SOURCES/lesspipe.sh
diff -u SOURCES/lesspipe.sh:1.25 SOURCES/lesspipe.sh:1.26
--- SOURCES/lesspipe.sh:1.25	Thu Nov  1 17:03:07 2007
+++ SOURCES/lesspipe.sh	Wed Nov  7 01:05:13 2007
@@ -26,6 +26,25 @@
 
 lesspipe() {
 	case "$1" in
+	# possible initrd images
+	*initrd-*.gz)
+		if [[ $(file -z "$1" 2>/dev/null) == *cpio?archive* ]]; then
+			echo "initrd contents:"
+			local out=$(gzip -dc "$1" | cpio -itv --quiet)
+			echo "$out"
+
+			# also display linuxrc
+			if [[ "$out" == *linuxrc* ]] ;then
+				echo ""
+				echo "/linuxrc program:"
+				local tmp=$(mktemp -d)
+				gzip -dc "$1" | (cd $tmp && cpio -dimu --quiet)
+				cat $tmp/linuxrc
+				rm -rf $tmp
+			fi
+		fi
+	;;
+
 	*.tar|*.phar) tar tvvf "$1" ;;
 	*.tgz|*.tar.gz|*.tar.[Zz]) tar tzvvf "$1" ;;
 	*.tbz2|*.tar.bz2) bzip2 -dc -- "$1" | tar tvvf - ;;
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/SOURCES/lesspipe.sh?r1=1.25&r2=1.26&f=u



More information about the pld-cvs-commit mailing list