wok-6.x diff xz/stuff/lzma @ rev 9342
lzma, xz: add lzma --size
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Mar 19 12:43:20 2011 +0100 (2011-03-19) |
parents | b07e53f0d08e |
children | 90ab20b44e0f |
line diff
1.1 --- a/xz/stuff/lzma Sun Jan 23 22:57:43 2011 +0100 1.2 +++ b/xz/stuff/lzma Sat Mar 19 12:43:20 2011 +0100 1.3 @@ -84,9 +84,19 @@ 1.4 esac 1.5 1.6 # First look if help is needed. 1.7 -[ "$1" ] || usage 1.8 case "$1" in 1.9 - --version|-V|--help|-h|-\?|'') usage;; 1.10 +--version|-V|--help|-h|-\?|'') usage;; 1.11 +--size) size=$(dd if=$2 bs=1 skip=5 count=8 2> /dev/null | od -t d8 | awk '{ print $2; exit }') 1.12 + if [ $size -eq -1 ]; then 1.13 + size=$(unlzma -c $2 | wc -c) 1.14 + n=$size 1.15 + for i in $(seq 1 8); do 1.16 + printf '\\\\x%02X' $(($n & 255)) 1.17 + n=$(($n >> 8)) 1.18 + done | xargs echo -en | dd of=$2 conv=notrunc bs=1 seek=5 2> /dev/null 1.19 + fi 1.20 + echo $size 1.21 + exit ;; 1.22 esac 1.23 1.24 # lzma_utils or lzma_alone ?