summaryrefslogtreecommitdiff
path: root/functions/losetup.sh
diff options
context:
space:
mode:
authorChris Lamb <chris@chris-lamb.co.uk>2008-09-07 15:39:29 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 19:03:41 +0100
commit8d373e005b776d56a327385d1569883758d5af21 (patch)
tree34682190cb8fced49bea0d40739a1c65d13e6845 /functions/losetup.sh
parentcf20a5b7b7208e503a39386d26961b4bfe457db4 (diff)
downloadvyos-live-build-8d373e005b776d56a327385d1569883758d5af21.tar.gz
vyos-live-build-8d373e005b776d56a327385d1569883758d5af21.zip
Refactor partition size calculation, ensuring a uniform increase for ext partitions.
Diffstat (limited to 'functions/losetup.sh')
-rwxr-xr-xfunctions/losetup.sh17
1 files changed, 17 insertions, 0 deletions
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)
+}