wok-stable diff xarchive/stuff/slitaz-wrap.sh @ rev 3194

Xarchive: add lzo support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed May 27 10:54:26 2009 +0200 (2009-05-27)
parents d1d5df9b017e
children 0109c31e8835
line diff
     1.1 --- a/xarchive/stuff/slitaz-wrap.sh	Mon May 04 13:35:07 2009 +0200
     1.2 +++ b/xarchive/stuff/slitaz-wrap.sh	Wed May 27 10:54:26 2009 +0200
     1.3 @@ -40,6 +40,7 @@
     1.4  CLOOP_EXTS="cloop"
     1.5  RAR_EXTS="rar cbr"
     1.6  LHA_EXTS="lha lzh lzs"
     1.7 +LZO_EXTS="lzo"
     1.8  
     1.9  # Setup awk program
    1.10  AWK_PROGS="mawk gawk awk"
    1.11 @@ -331,6 +332,7 @@
    1.12  arj		arj
    1.13  7za		7z
    1.14  lha		$LHA_EXTS
    1.15 +lzop		$LZO_EXTS
    1.16  EOT
    1.17          printf "\n"
    1.18          exit
    1.19 @@ -622,6 +624,40 @@
    1.20                  exit 0
    1.21  	    fi
    1.22  	done
    1.23 +        for ext in $LZO_EXTS; do
    1.24 +            if [ $(expr "$lc_archive" : ".*\."$ext"$") -gt 0 ]; then
    1.25 +        # format of lzo output:
    1.26 +# Method         Length    Packed  Ratio     Date    Time   Name
    1.27 +# ------         ------    ------  -----     ----    ----   ----
    1.28 +# LZO1X-1           626       526  84.0%  2009-05-27 09:52  file
    1.29 +# LZO1X-1         10057      5675  56.4%  2005-07-25 16:26  path/file
    1.30 +#               -------   -------  -----                    ----
    1.31 +# 1               2          3     4      5          6      7
    1.32 +                lzop -Plv "$archive" | $AWK_PROG -v uuid=$(id -u -n) '
    1.33 +	BEGIN { show = 0}
    1.34 +        {
    1.35 +          if ($5 == "----" || $4 == "----") {
    1.36 +          	show = 1 - show
    1.37 +          	next
    1.38 +          }
    1.39 +	  attr="-rw-r--r--"
    1.40 +          uid=uuid; gid=uuid
    1.41 +          size=$2
    1.42 +          date=$5
    1.43 +          time=$6
    1.44 +          
    1.45 +          #this method works with filenames that start with a space (evil!)
    1.46 +          #split line a time and a space
    1.47 +          split($0,linesplit, $6 "  ")
    1.48 +
    1.49 +          name=linesplit[2]
    1.50 +          link="-"	# links are not supported
    1.51 +
    1.52 +          if (show == 1) printf "%s;%s;%s;%s;%s;%s;%s;%s\n",name,size,attr,uid,gid,date,time,link
    1.53 +        }'
    1.54 +                exit 0
    1.55 +	    fi
    1.56 +	done
    1.57          exit $E_UNSUPPORTED
    1.58          ;;
    1.59  
    1.60 @@ -756,6 +792,7 @@
    1.61  unzip		-n	$ZIP_EXTS
    1.62  dpkg-deb	-X	$DEB_EXTS
    1.63  lha		x	$LHA_EXTS
    1.64 +lzop		-x	$LZO_EXTS
    1.65  EOT
    1.66  	while read exe args argpass exts; do
    1.67  	    [ "$(which $exe)" ] || continue