makedmg.sh 744 Bytes
Newer Older
Daniel Molkentin's avatar
Daniel Molkentin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14
#!/bin/bash

[ $# -lt 2 ] && echo "Usage: $(basename $0) <folder> <name.dmg>" && exit 2
[ $(uname -s) != "Darwin" ] && echo "Run this script on Mac OS X" && exit 2;
sourceFolder="$1"
intermediateFolder=$(mktemp -d "/tmp/packagedir.XXXXX")
finalDMGName="$2"
title="Qt Creator"

echo Preparing image artifacts...
cp -a "${sourceFolder}/" "${intermediateFolder}"
ln -s /Applications "${intermediateFolder}"
cp "$(dirname "${BASH_SOURCE[0]}")/../LICENSE.LGPL" "${intermediateFolder}/LICENSE_LGPL.txt"
echo Creating image...
15
hdiutil create -srcfolder "${intermediateFolder}" -volname "${title}" -format UDBZ "${finalDMGName}" -ov -scrub -size 1g -verbose
16 17
# make sure that the image is umounted etc
sleep 4
Daniel Molkentin's avatar
Daniel Molkentin committed
18 19 20

# clean up
rm -rf "${intermediateFolder}"