~ubuntu-branches/ubuntu/wily/openms/wily

« back to all changes in this revision

Viewing changes to cmake/MacOSX/fixdmg.sh

  • Committer: Package Import Robot
  • Author(s): Filippo Rusconi
  • Date: 2013-12-20 11:30:16 UTC
  • mfrom: (5.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20131220113016-wre5g9bteeheq6he
Tags: 1.11.1-3
* remove version number from libbost development package names;
* ensure that AUTHORS is correctly shipped in all packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
6
6
 
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
 
9
# <wait 1-2min>
 
10
# defaults write com.apple.Finder AppleShowAllFiles FALSE && killall Finder
 
11
 
 
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
11
17
 
12
18
if [ ! -e ${DMG_NAME} ]
13
19
then
17
23
 
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
 
27
 
 
28
device=$(hdiutil attach -readwrite -noverify -noautoopen "temp.dmg" | \
 
29
         egrep '^/dev/' | sed 1q | awk '{print $1}')
21
30
 
22
31
# remove original dmg
23
32
rm -f ${DMG_NAME}
24
33
 
25
34
# wait till package is open
26
 
sleep 10
 
35
#sleep 10
27
36
 
28
 
echo '
29
 
  tell application "Finder"
 
37
echo 'tell application "Finder"
30
38
        tell disk "'${DISK_NAME}'"
31
 
                open
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
42
 
                
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}
45
 
                
46
 
                -- work around for Snow Leopard bug
47
 
                close
48
 
                open
49
 
                
50
 
                update without registering applications
51
 
                delay 5
52
 
                eject
 
39
    with timeout of 300 seconds
 
40
                open
 
41
 
 
42
                        set theXOrigin to 400
 
43
                        set theYOrigin to 200
 
44
                        set theBottomRightX to 1030
 
45
                        set theBottomRightY to 785
 
46
 
 
47
                        tell container window
 
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
 
53
                        end tell
 
54
 
 
55
                        update without registering applications
 
56
                        delay 1
 
57
 
 
58
                set theViewOptions to the icon view options of container window
 
59
                set arrangement of theViewOptions to not arranged
 
60
 
 
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
 
65
 
 
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}
 
68
 
 
69
                --give the finder some time to write the .DS_Store file
 
70
                delay 3
 
71
 
 
72
                -- work around for Snow Leopard bug
 
73
                close
 
74
                open
 
75
 
 
76
                update without registering applications
 
77
                -- delay 5
 
78
 
 
79
      -- try eject
 
80
      eject
 
81
    end timeout
53
82
        end tell
54
83
end tell
55
84
' | osascript
56
85
 
57
86
# be sure that everything is done
58
 
sleep 10
59
 
 
60
 
hdiutil convert temp.dmg -format UDZO -imagekey zlib-level=9 -o ${DMG_NAME}
 
87
#sleep 10
 
88
 
 
89
chmod -Rf go-w /Volumes/"${DISK_NAME}"
 
90
sync
 
91
sync
 
92
hdiutil detach ${device}
 
93
hdiutil convert "temp.dmg" -format UDZO -imagekey zlib-level=9 -o "${DMG_NAME}"
 
94
#rm -f /pack.temp.dmg
 
95
 
 
96
# hdiutil convert temp.dmg -format UDZO -imagekey zlib-level=9 -o ${DMG_NAME}
61
97
rm -f temp.dmg
 
98
 
 
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}"
 
104
fi