2011-05-21 00:50:50 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2011-05-22 00:43:13 +02:00
|
|
|
# the following environment variables must be set
|
2012-12-11 02:07:51 +01:00
|
|
|
: ${ROOT_DIR?} ${BUILD_DIR?} ${PACKAGE_LBL?} ${PACKAGE_DIR?} ${FW_DIR?} ${PACKAGE_NAME?} ${PACKAGE_SEP?}
|
2011-05-22 00:43:13 +02:00
|
|
|
|
|
|
|
# more variables
|
2013-03-30 16:33:38 +01:00
|
|
|
APP_PATH="${BUILD_DIR}/openpilotgcs_release/bin/OpenPilot GCS.app"
|
2011-05-28 02:14:51 +02:00
|
|
|
TEMP_FILE="${PACKAGE_DIR}/OpenPilot-temp.dmg"
|
2012-12-12 19:26:11 +01:00
|
|
|
OUT_FILE="${PACKAGE_DIR}/../${PACKAGE_NAME}${PACKAGE_SEP}${PACKAGE_LBL}${PACKAGE_SEP}osx.dmg"
|
2011-05-22 00:43:13 +02:00
|
|
|
VOL_NAME="OpenPilot"
|
|
|
|
|
|
|
|
# prepare the stage
|
|
|
|
rm -f "${TEMP_FILE}"
|
|
|
|
rm -f "${OUT_FILE}"
|
|
|
|
|
2013-06-21 10:55:35 +02:00
|
|
|
# if an OpenPilot volume is already mounted, unmount it
|
2013-06-02 14:26:14 +02:00
|
|
|
if [ ! -f "/Volumes/${VOL_NAME}" ]
|
|
|
|
then
|
|
|
|
hdiutil unmount "/Volumes/${VOL_NAME}"
|
|
|
|
fi
|
|
|
|
|
2011-05-28 02:14:51 +02:00
|
|
|
hdiutil convert "${ROOT_DIR}/package/osx/OpenPilot.dmg" \
|
2013-04-04 14:52:16 +02:00
|
|
|
-format UDRW -o "${TEMP_FILE}"
|
|
|
|
device=$(hdiutil attach "${TEMP_FILE}" | \
|
|
|
|
egrep '^/dev/' | sed 1q | awk '{print $1}')
|
2011-05-21 00:50:50 +02:00
|
|
|
|
|
|
|
# packaging goes here
|
2013-04-03 17:41:30 +02:00
|
|
|
cp -a "${APP_PATH}" "/Volumes/${VOL_NAME}"
|
2013-05-26 21:47:43 +02:00
|
|
|
#ls "${FW_DIR}" | xargs -n 1 -I {} cp "${FW_DIR}/{}" "/Volumes/${VOL_NAME}/Firmware"
|
2012-05-04 18:39:33 +02:00
|
|
|
cp "${BUILD_DIR}/uavobject-synthetics/matlab/OPLogConvert.m" "/Volumes/${VOL_NAME}/Utilities"
|
2013-06-01 22:39:40 +02:00
|
|
|
cp "${ROOT_DIR}/WHATSNEW.txt" "/Volumes/${VOL_NAME}"
|
2013-06-02 14:26:14 +02:00
|
|
|
cp "${ROOT_DIR}/README.txt" "/Volumes/${VOL_NAME}/Docs"
|
|
|
|
cp "${ROOT_DIR}/MILESTONES.txt" "/Volumes/${VOL_NAME}/Docs"
|
|
|
|
cp "${ROOT_DIR}/LICENSE.txt" "/Volumes/${VOL_NAME}/Docs"
|
|
|
|
cp "${ROOT_DIR}/GPLv3.txt" "/Volumes/${VOL_NAME}/Docs"
|
2011-08-04 22:25:11 +02:00
|
|
|
|
2011-05-28 02:14:51 +02:00
|
|
|
"${ROOT_DIR}/package/osx/libraries" \
|
2013-04-04 14:52:16 +02:00
|
|
|
"/Volumes/${VOL_NAME}/OpenPilot GCS.app" || exit 1
|
2011-05-21 18:08:00 +02:00
|
|
|
|
2011-05-21 00:50:50 +02:00
|
|
|
hdiutil detach ${device}
|
2011-08-05 01:45:27 +02:00
|
|
|
|
2011-12-10 21:02:18 +01:00
|
|
|
min=`hdiutil resize ${TEMP_FILE} | awk \{print\ \$\1\}`
|
|
|
|
echo "Resizing dmg to ${min}"
|
|
|
|
|
|
|
|
hdiutil resize -sectors ${min} ${TEMP_FILE}
|
2011-05-22 00:43:13 +02:00
|
|
|
hdiutil convert "${TEMP_FILE}" -format UDZO -o "${OUT_FILE}"
|
2011-05-21 00:50:50 +02:00
|
|
|
|
2011-05-22 00:43:13 +02:00
|
|
|
# cleanup
|
|
|
|
rm "${TEMP_FILE}"
|