summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-05-18 08:55:17 -0300
committerRenato Botelho <renato@netgate.com>2016-05-18 08:55:17 -0300
commit21016bb512f4ce6b134b0f11c01583da04d2fc11 (patch)
treeb6c10b6546cdd290d2a2f9b4f2929b9e4c078cb3 /tools
parent0ade7f010f4bdf7557085571220eb59e0bb501bd (diff)
downloadpfsense-21016bb512f4ce6b134b0f11c01583da04d2fc11.zip
pfsense-21016bb512f4ce6b134b0f11c01583da04d2fc11.tar.gz
Do not use makefs to create / partition since it fails badly sometimes
Diffstat (limited to 'tools')
-rw-r--r--tools/builder_common.sh38
1 files changed, 18 insertions, 20 deletions
diff --git a/tools/builder_common.sh b/tools/builder_common.sh
index 70bb590..8043e23 100644
--- a/tools/builder_common.sh
+++ b/tools/builder_common.sh
@@ -879,7 +879,8 @@ create_ova_image() {
[ -d "${OVA_TMP}" ] \
&& rm -rf ${OVA_TMP}
- mkdir -p ${OVA_TMP}
+ local _mntdir=${OVA_TMP}/mnt
+ mkdir -p ${_mntdir}
if [ -z "${OVA_SWAP_PART_SIZE_IN_GB}" -o "${OVA_SWAP_PART_SIZE_IN_GB}" = "0" ]; then
# first partition size (freebsd-ufs)
@@ -914,31 +915,28 @@ create_ova_image() {
# Create / partition
echo -n ">>> Creating / partition... " | tee -a ${LOGFILE}
- makefs \
- -B little \
- -o label=${PRODUCT_NAME},version=2,bsize=32768,fsize=4096,maxbpg=4096,density=8192,minfree=8 \
- -s ${OVA_FIRST_PART_SIZE} \
- ${OVA_TMP}/${OVFUFS} \
- ${FINAL_CHROOT_DIR} 2>&1 >> ${LOGFILE}
-
- if [ $? -ne 0 -o ! -f ${OVA_TMP}/${OVFUFS} ]; then
- if [ -f ${OVA_TMP}/${OVFUFS} ]; then
- rm -f ${OVA_TMP}/${OVFUFS}
- fi
- echo "Failed!" | tee -a ${LOGFILE}
- echo ">>> ERROR: Error creating vmdk / partition. STOPPING!" | tee -a ${LOGFILE}
- print_error_pfS
- fi
- echo "Done!" | tee -a ${LOGFILE}
+ truncate -s ${OVA_FIRST_PART_SIZE} ${OVA_TMP}/${OVFUFS}
+ local _md=$(mdconfig -a -f ${OVA_TMP}/${OVAUFS})
+ trap "mdconfig -d -u ${_md}; return" 1 2 15 EXIT
+
+ newfs -L ${PRODUCT_NAME} -j /dev/${_md} 2>&1 >>${LOGFILE}
- echo -n ">>> Enabling SUJ on recently created disk... " | tee -a ${LOGFILE}
- if ! tunefs -j enable ${OVA_TMP}/${OVFUFS} 2>&1 >>${LOGFILE}; then
+ if ! mount /dev/${_md} ${_mntdir} 2>&1 >>${LOGFILE}; then
echo "Failed!" | tee -a ${LOGFILE}
- echo ">>> ERROR: Error enabling SUJ on disk. STOPPING!" | tee -a ${LOGFILE}
+ echo ">>> ERROR: Error mounting temporary vmdk image. STOPPING!" | tee -a ${LOGFILE}
print_error_pfS
fi
+ trap "umount ${_mntdir}; mdconfig -d -u ${_md}; return" 1 2 15 EXIT
+
echo "Done!" | tee -a ${LOGFILE}
+ clone_directory_contents ${FINAL_CHROOT_DIR} ${_mntdir}
+
+ sync
+ umount ${_mntdir} 2>&1 >>${LOGFILE}
+ mdconfig -d -u ${_md}
+ trap "-" 1 2 15 EXIT
+
# Create raw disk
echo -n ">>> Creating raw disk... " | tee -a ${LOGFILE}
mkimg \
OpenPOWER on IntegriCloud