From 8d373e005b776d56a327385d1569883758d5af21 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Sun, 7 Sep 2008 15:39:29 +0100 Subject: Refactor partition size calculation, ensuring a uniform increase for ext partitions. --- functions/losetup.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'functions') diff --git a/functions/losetup.sh b/functions/losetup.sh index 233e63796..3c470f988 100755 --- a/functions/losetup.sh +++ b/functions/losetup.sh @@ -35,3 +35,20 @@ Losetup () ${LH_ROOT_COMMAND} ${LH_LOSETUP} -o "${OFFSET}" "${DEVICE}" "${FILE}" fi } + +Calculate_partition_size () +{ + ORIGINAL_SIZE="${1}" + FILESYSTEM="${2}" + + case "${FILESYSTEM}" in + ext2|ext3) + PERCENT="5" + ;; + *) + PERCENT="2" + ;; + esac + + echo $(expr ${ORIGINAL_SIZE} + ${ORIGINAL_SIZE} \* ${PERCENT} / 100) +} -- cgit v1.2.3