+cp icons/dcpomatic.icns $WORK/$resources/DVD-o-matic.icns
+
+tmp_dmg=$WORK/dcpomatic_tmp.dmg
+dmg="$WORK/DCP-o-matic $version.dmg"
+vol_name=DCP-o-matic-$version
+
+mkdir -p $WORK/$vol_name
+
+rm -f $tmp_dmg "$dmg"
+hdiutil create -megabytes $DMG_SIZE $tmp_dmg
+device=$(hdid -nomount $tmp_dmg | grep Apple_HFS | cut -f 1 -d ' ')
+newfs_hfs -v ${vol_name} $device
+mount -t hfs "$device" $WORK/$vol_name
+
+cp -r $WORK/$appdir $WORK/$vol_name
+
+echo '
+ tell application "Finder"
+ tell disk "'$vol_name'"
+ open
+ set current view of container window to icon view
+ set toolbar visible of container window to false
+ set statusbar visible of container window to false
+ set the bounds of container window to {400, 200, 790, 410}
+ set theViewOptions to the icon view options of container window
+ set arrangement of theViewOptions to not arranged
+ set icon size of theViewOptions to 64
+ make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"}
+ set position of item "DCP-o-matic.app" of container window to {90, 80}
+ set position of item "Applications" of container window to {310, 80}
+ close
+ open
+ update without registering applications
+ delay 5
+ eject
+ end tell
+ end tell
+' | osascript