summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-08-27 11:33:31 -0300
committerRenato Botelho <renato@netgate.com>2015-08-27 11:33:31 -0300
commit50dcadff366976398e5be01b70276886be6a5a5e (patch)
tree3e146760fe5e7e3e98eb08407faed4b2688dc32e /tools
parenta82b9f43fa4d5bdcc1b44593563a166afe3916b2 (diff)
downloadpfsense-50dcadff366976398e5be01b70276886be6a5a5e.zip
pfsense-50dcadff366976398e5be01b70276886be6a5a5e.tar.gz
Remove unnecessary variables, also add some error checking
Diffstat (limited to 'tools')
-rw-r--r--tools/builder_common.sh25
1 files changed, 19 insertions, 6 deletions
diff --git a/tools/builder_common.sh b/tools/builder_common.sh
index 5ef36d8..0fba48f 100644
--- a/tools/builder_common.sh
+++ b/tools/builder_common.sh
@@ -905,12 +905,25 @@ ova_calculate_mnt_size() {
# called from create_ova_image
ova_create_raw_backed_file() {
- DISKSIZE=$OVADISKSIZE
- BLOCKSIZE=$OVABLOCKSIZE
- COUNT=$((${DISKSIZE}/${BLOCKSIZE}))
- DISKFILE=${IMAGES_FINAL_DIR}/${OVFVMDK}.raw
- echo ">>> Creating raw backing file ${DISKFILE} (Disk Size: ${DISKSIZE}, Block Size: ${BLOCKSIZE}, Count: ${COUNT})..." | tee -a ${LOGFILE}
- dd if=/dev/zero of=$DISKFILE bs=$BLOCKSIZE count=0 seek=$COUNT
+ if [ -z "${OVADISKSIZE}" ]; then
+ echo ">>> ERROR: OVADISKSIZE is not defined"
+ print_error_pfS
+ fi
+
+ if [ -z "${OVABLOCKSIZE}" ]; then
+ echo ">>> ERROR: OVABLOCKSIZE is not defined"
+ print_error_pfS
+ fi
+
+ if [ -z "${OVFVMDK}" ]; then
+ echo ">>> ERROR: OVFVMDK is not defined"
+ print_error_pfS
+ fi
+
+ local COUNT=$((${OVADISKSIZE}/${OVABLOCKSIZE}))
+ local DISKFILE=${IMAGES_FINAL_DIR}/${OVFVMDK}.raw
+ echo ">>> Creating raw backing file ${DISKFILE} (Disk Size: ${OVADISKSIZE}, Block Size: ${OVABLOCKSIZE}, Count: ${COUNT})..." | tee -a ${LOGFILE}
+ dd if=/dev/zero of=$DISKFILE bs=$OVABLOCKSIZE count=0 seek=$COUNT
}
# called from create_ova_image
OpenPOWER on IntegriCloud