mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-04 12:24:11 +01:00
50 lines
1.6 KiB
Bash
Executable File
50 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# the following environment variables must be set
|
|
: ${ROOT_DIR?} ${BUILD_DIR?} ${PACKAGE_LBL?} ${PACKAGE_DIR?} ${FW_DIR?} ${PACKAGE_NAME?} ${PACKAGE_SEP?}
|
|
|
|
# more variables
|
|
APP_PATH="${BUILD_DIR}/openpilotgcs_release/bin/OpenPilot GCS.app"
|
|
TEMP_FILE="${PACKAGE_DIR}/OpenPilot-temp.dmg"
|
|
OUT_FILE="${PACKAGE_DIR}/../${PACKAGE_NAME}${PACKAGE_SEP}${PACKAGE_LBL}${PACKAGE_SEP}osx.dmg"
|
|
VOL_NAME="OpenPilot"
|
|
|
|
# prepare the stage
|
|
rm -f "${TEMP_FILE}"
|
|
rm -f "${OUT_FILE}"
|
|
|
|
# if an OpenPilot volume is already mounted, unmount it
|
|
if [ ! -f "/Volumes/${VOL_NAME}" ]
|
|
then
|
|
hdiutil unmount "/Volumes/${VOL_NAME}"
|
|
fi
|
|
|
|
hdiutil convert "${ROOT_DIR}/package/osx/OpenPilot.dmg" \
|
|
-format UDRW -o "${TEMP_FILE}"
|
|
device=$(hdiutil attach "${TEMP_FILE}" | \
|
|
egrep '^/dev/' | sed 1q | awk '{print $1}')
|
|
|
|
# packaging goes here
|
|
cp -a "${APP_PATH}" "/Volumes/${VOL_NAME}"
|
|
#ls "${FW_DIR}" | xargs -n 1 -I {} cp "${FW_DIR}/{}" "/Volumes/${VOL_NAME}/Firmware"
|
|
cp "${BUILD_DIR}/uavobject-synthetics/matlab/OPLogConvert.m" "/Volumes/${VOL_NAME}/Utilities"
|
|
cp "${ROOT_DIR}/WHATSNEW.txt" "/Volumes/${VOL_NAME}"
|
|
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"
|
|
|
|
"${ROOT_DIR}/package/osx/libraries" \
|
|
"/Volumes/${VOL_NAME}/OpenPilot GCS.app" || exit 1
|
|
|
|
hdiutil detach ${device}
|
|
|
|
min=`hdiutil resize ${TEMP_FILE} | awk \{print\ \$\1\}`
|
|
echo "Resizing dmg to ${min}"
|
|
|
|
hdiutil resize -sectors ${min} ${TEMP_FILE}
|
|
hdiutil convert "${TEMP_FILE}" -format UDZO -o "${OUT_FILE}"
|
|
|
|
# cleanup
|
|
rm "${TEMP_FILE}"
|