Permalink
Browse files

lsinitramfs: display ratio as a decimal rather than a percent

simplifies things a fair bit and gets rid of the divide function
  • Loading branch information...
1 parent 333466f commit 981e2c1993d7c78d955adb42b65b2a59c7d27e39 @falconindy committed May 16, 2011
Showing with 2 additions and 8 deletions.
  1. +2 −8 lsinitramfs
View
@@ -92,15 +92,9 @@ if (( analyze )); then
# calculate compression ratio
if [[ $compress ]]; then
- divide() {
- local A=$1 B=$2 ratio=
-
- ratio=$(( A * 10000 / B % 10000 ))
- printf '%s.%s%%\n' "${ratio:0:2}" "${ratio:2}"
- }
-
TIMEFORMAT=%R decomptime=$({ time decomp "$image" >/dev/null; } 2>&1 )
- ratio=$(divide "$(stat -c %s "$image")" "$(decomp "$image" | bsdtar xOf - | wc -c)")
+ ratio=.$(( $(stat -c %s "$image") * 1000 /
+ $(decomp "$image" | bsdtar xOf - | wc -c) % 1000 ))
fi
# read contents of image

0 comments on commit 981e2c1

Please sign in to comment.