4
4
# based on http://stackoverflow.com/questions/96882/how-do-i-create-a-nice-looking-dmg-for-mac-os-x-using-command-line-tools
5
5
# bash script to further customize the OpenMS dmg
7
DISK_NAME=OpenMS-1.9.0-Darwin
7
# if the apple script part fails with "timed out" error try
8
# defaults write com.apple.Finder AppleShowAllFiles TRUE && killall Finder
10
# defaults write com.apple.Finder AppleShowAllFiles FALSE && killall Finder
12
DISK_NAME=OpenMS-1.11.1-Darwin
8
13
DMG_NAME=${DISK_NAME}.dmg
9
OPENMS_NAME=OpenMS-1.9.0
14
OPENMS_NAME=OpenMS-1.11.1
10
15
backgroundPictureName=.background.png
16
LICENSE=${PWD}/_CPack_Packages/Darwin/DragNDrop/sla.r
12
18
if [ ! -e ${DMG_NAME} ]
18
24
# make dmg writable
19
25
hdiutil convert ${DMG_NAME} -format UDRW -o temp.dmg
20
hdiutil attach temp.dmg
26
#hdiutil attach temp.dmg
28
device=$(hdiutil attach -readwrite -noverify -noautoopen "temp.dmg" | \
29
egrep '^/dev/' | sed 1q | awk '{print $1}')
22
31
# remove original dmg
25
34
# wait till package is open
29
tell application "Finder"
37
echo 'tell application "Finder"
30
38
tell disk "'${DISK_NAME}'"
32
set current view of container window to icon view
33
set toolbar visible of container window to false
34
set statusbar visible of container window to false
35
set the bounds of container window to {400, 200, 1030, 785}
36
set theViewOptions to the icon view options of container window
37
set arrangement of theViewOptions to not arranged
38
-- if we have a fixed resolution we can also set this
39
set icon size of theViewOptions to 72
40
set bgimg to "'${OPENMS_NAME}':share:OpenMS:background.png" as text
41
set background picture of theViewOptions to file bgimg
43
set the position of item "'${OPENMS_NAME}'" of container window to {470, 140}
44
set the position of item "Applications" of container window to {160, 140}
46
-- work around for Snow Leopard bug
50
update without registering applications
39
with timeout of 300 seconds
44
set theBottomRightX to 1030
45
set theBottomRightY to 785
48
set current view to icon view
49
set toolbar visible to false
50
set statusbar visible to false
51
set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
52
set statusbar visible to false
55
update without registering applications
58
set theViewOptions to the icon view options of container window
59
set arrangement of theViewOptions to not arranged
61
-- if we have a fixed resolution we can also set this
62
set icon size of theViewOptions to 72
63
set bgimg to "'${OPENMS_NAME}':share:OpenMS:background.png" as text
64
set background picture of theViewOptions to file bgimg
66
set the position of item "'${OPENMS_NAME}'" of container window to {470, 140}
67
set the position of item "Applications" of container window to {160, 140}
69
--give the finder some time to write the .DS_Store file
72
-- work around for Snow Leopard bug
76
update without registering applications
57
86
# be sure that everything is done
60
hdiutil convert temp.dmg -format UDZO -imagekey zlib-level=9 -o ${DMG_NAME}
89
chmod -Rf go-w /Volumes/"${DISK_NAME}"
92
hdiutil detach ${device}
93
hdiutil convert "temp.dmg" -format UDZO -imagekey zlib-level=9 -o "${DMG_NAME}"
96
# hdiutil convert temp.dmg -format UDZO -imagekey zlib-level=9 -o ${DMG_NAME}
99
if [ ! -z "${LICENSE}" -a "${LICENSE}" != "-null-" ]; then
100
echo "adding EULA resources"
101
hdiutil unflatten "${DMG_NAME}"
102
ResMerger "${LICENSE}" -a -o "${DMG_NAME}"
103
hdiutil flatten "${DMG_NAME}"