]> git.pld-linux.org Git - packages/less.git/commitdiff
- display contents of compressed cpio initrd auto/ti/lesspipe-1_0-1
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 7 Nov 2007 00:05:13 +0000 (00:05 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    lesspipe.sh -> 1.26

lesspipe.sh

index 98da838c7099bf8807ca34dbcf5fccffd35ff79d..ffa936452b6068c3a1f278c0c214e56fd830fdf0 100644 (file)
 
 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 - ;;
This page took 0.108863 seconds and 4 git commands to generate.