From 428da01aea94c7d4667c0be1b7498f8edd6772e0 Mon Sep 17 00:00:00 2001
From: Michael Stummvoll <michael@stummi.org>
Date: Tue, 2 Apr 2013 13:59:38 +0200
Subject: Using LB_HDD_SIZE to determine the size of the image.

If LB_HDD_SIZE is "auto" the size will be determined automatically as before
else it will be the given size in MB.

Also setting the default for this to "auto"
---
 functions/defaults.sh    |  2 +-
 scripts/build/binary_hdd | 10 ++++++++--
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/functions/defaults.sh b/functions/defaults.sh
index c64917abb..ff268ba0b 100755
--- a/functions/defaults.sh
+++ b/functions/defaults.sh
@@ -890,7 +890,7 @@ Set_defaults ()
 	esac
 
 	# Setting hdd size
-	LB_HDD_SIZE="${LB_HDD_SIZE:-10000}"
+	LB_HDD_SIZE="${LB_HDD_SIZE:-auto}"
 
 	# Setting iso volume
 	case "${LB_MODE}" in
diff --git a/scripts/build/binary_hdd b/scripts/build/binary_hdd
index 9f075212b..6527a3c85 100755
--- a/scripts/build/binary_hdd
+++ b/scripts/build/binary_hdd
@@ -121,8 +121,14 @@ then
 fi
 
 # Everything which comes here needs to be cleaned up,
-DU_DIM="$(du -ms binary | cut -f1)"
-REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LB_BINARY_FILESYSTEM})"
+if [ "$LB_HDD_SIZE" = "auto" ];
+then
+	DU_DIM="$(du -ms binary | cut -f1)"
+	REAL_DIM="$(Calculate_partition_size ${DU_DIM} ${LB_BINARY_FILESYSTEM})"
+else
+	REAL_DIM=$LB_HDD_SIZE
+fi
+
 dd if=/dev/zero of=chroot/binary.img bs=1024k count=0 seek=${REAL_DIM}
 FREELO="$(${LB_LOSETUP} -f)"
 if [ ! -b chroot/${FREELO} ]
-- 
cgit v1.2.3