Commit e1f8a3f7 authored by Jérémy Bobbio's avatar Jérémy Bobbio

Factor out conversion to megabytes in partman

The conversion to megabytes is done by a creepy mix of calculation and
pattern matching.  This is now hidden away in a new function,
convert_to_megabytes() in lib/base.sh.

All callers of such conversion has been updated.

r55252
parent 7e7fa5e2
partman-partitioning (62) UNRELEASED; urgency=low
[ Jérémy Bobbio ]
* Use convert_to_megabytes() in free_space/new/do_option and
lib/resize.sh:ask_for_size().
Depends: partman-base (>= 125)
-- Jérémy Bobbio <lunar@debian.org> Wed, 20 Aug 2008 00:06:08 +0200
partman-partitioning (61) unstable; urgency=low
[ Jérémy Bobbio ]
......
......@@ -39,7 +39,7 @@ ask_for_size () {
*%)
digits=$(expr "$RET" : '\([1-9][0-9]*\) *%$')
if [ "$digits" ]; then
maxmb=$(expr 0000000"$freesize" : '0*\(..*\)......$')
maxmb=$(convert_to_megabytes $freesize)
size=$(($digits * $maxmb / 100))000000
fi
if [ "$digits" = 100 ]; then
......
......@@ -125,7 +125,7 @@ ask_for_size () {
*%)
digits=$(expr "$RET" : '\([1-9][0-9]*\) *%$')
if [ "$digits" ]; then
maxmb=$(expr 0000000"$maxsize" : '0*\(..*\)......$')
maxmb=$(convert_to_megabytes $maxsize)
newsize=$(($digits * $maxmb / 100))000000
fi
;;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment