wok diff xz/stuff/lzma @ rev 15501

connman: kill dhcpd before starting
author Dominique Corbex <domcox@slitaz.org>
date Sun Nov 17 16:55:13 2013 +0100 (2013-11-17)
parents 885c330a75ba
children 02c70d036ea0
line diff
     1.1 --- a/xz/stuff/lzma	Sat Mar 19 12:43:20 2011 +0100
     1.2 +++ b/xz/stuff/lzma	Sun Nov 17 16:55:13 2013 +0100
     1.3 @@ -78,6 +78,15 @@
     1.4  	exit
     1.5  }
     1.6  
     1.7 +fix_size()
     1.8 +{
     1.9 +	n=$1
    1.10 +	for i in $(seq 1 8); do
    1.11 +		printf '\\\\x%02X' $(($n & 255))
    1.12 +		n=$(($n >> 8))
    1.13 +	done | xargs echo -en | dd of=$2 conv=notrunc bs=1 seek=5 2> /dev/null
    1.14 +}
    1.15 +
    1.16  case "$0" in
    1.17  *unlzma) lzma_utils -d $@ ;;
    1.18  *lzcat)  lzma_utils -c -d $@ ;;
    1.19 @@ -86,14 +95,10 @@
    1.20  # First look if help is needed.
    1.21  case "$1" in
    1.22  --version|-V|--help|-h|-\?|'') usage;;
    1.23 ---size) size=$(dd if=$2 bs=1 skip=5 count=8 2> /dev/null | od -t d8 | awk '{ print $2; exit }') 
    1.24 +--size) size=$(od -t d8 -j5 -N8 < $2 | awk '{ print $2; exit }') 
    1.25  	if [ $size -eq -1 ]; then
    1.26  		size=$(unlzma -c $2 | wc -c)
    1.27 -		n=$size
    1.28 -		for i in $(seq 1 8); do
    1.29 -			printf '\\\\x%02X' $(($n & 255))
    1.30 -			n=$(($n >> 8))
    1.31 -		done | xargs echo -en | dd of=$2 conv=notrunc bs=1 seek=5 2> /dev/null
    1.32 +		fix_size $size $2
    1.33  	fi
    1.34  	echo $size
    1.35  	exit ;;
    1.36 @@ -128,14 +133,6 @@
    1.37  
    1.38  # fake lzma_alone (-eos -mt1)
    1.39  eval xz $args --format=lzma --$mode$extra --stdout $input $output || usage error
    1.40 -if [ -n "$input" -a -n "$output" ]; then
    1.41 -	size=$(stat -c "%s" ${input#< })
    1.42 -	ascii="00000 "
    1.43 -	for i in 1 2 3 4 5 6 7 8; do
    1.44 -		ascii="$ascii $(printf "%02x" $((size % 256)) )"
    1.45 -		size=$(( $size / 256 ))
    1.46 -	done
    1.47 -	echo "$ascii | .." | hexdump -R | \
    1.48 -	dd of=${output#> } seek=5 bs=1 conv=notrunc 2> /dev/null
    1.49 -fi
    1.50 +[ -n "$input" -a -n "$output" ] &&
    1.51 +	fix_size $(stat -c "%s" ${input#< }) ${output#> }
    1.52  exit 0