diff options
Diffstat (limited to 'linden/indra/newview/packaging/mac/ConfigureDMG.scpt')
-rw-r--r-- | linden/indra/newview/packaging/mac/ConfigureDMG.scpt | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/linden/indra/newview/packaging/mac/ConfigureDMG.scpt b/linden/indra/newview/packaging/mac/ConfigureDMG.scpt new file mode 100644 index 0000000..198ab9e --- /dev/null +++ b/linden/indra/newview/packaging/mac/ConfigureDMG.scpt | |||
@@ -0,0 +1,110 @@ | |||
1 | (* | ||
2 | |||
3 | @file ConfigureDMG.scpt | ||
4 | @author Jacek Antonelli | ||
5 | @brief Script for configuring the Mac installer disk image. | ||
6 | |||
7 | Copyright (c) 2011, Jacek Antonelli | ||
8 | |||
9 | Permission is hereby granted, free of charge, to any person | ||
10 | obtaining a copy of this software and associated documentation files | ||
11 | (the "Software"), to deal in the Software without restriction, | ||
12 | including without limitation the rights to use, copy, modify, merge, | ||
13 | publish, distribute, sublicense, and/or sell copies of the Software, | ||
14 | and to permit persons to whom the Software is furnished to do so, | ||
15 | subject to the following conditions: | ||
16 | |||
17 | The above copyright notice and this permission notice shall be | ||
18 | included in all copies or substantial portions of the Software. | ||
19 | |||
20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
21 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
22 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
23 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
24 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
25 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
26 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
27 | SOFTWARE. | ||
28 | |||
29 | ----- | ||
30 | |||
31 | This AppleScript script configures the view options and icon layout of | ||
32 | the Mac installer disk image (DMG) as part of the packaging process. | ||
33 | See also scripts/package.py, which executes this script. | ||
34 | |||
35 | This script takes two required positional command line arguments: | ||
36 | |||
37 | 1: the name of the mounted volume (e.g. for "/Volumes/Imprudence Installer", | ||
38 | the volume name is "Imprudence Installer"). | ||
39 | 2: the name of the application file (e.g. "Imprudence.app"). | ||
40 | |||
41 | Example usage: | ||
42 | |||
43 | osascript ConfigureDMG.scpt "Imprudence Installer" "Imprudence.app" | ||
44 | |||
45 | Some preparation is necessary before running this script: | ||
46 | |||
47 | * The target disk image must be currently attached as a volume, with | ||
48 | the volume name specified by the first command line argument. | ||
49 | * The volume must contain the application file, with the file | ||
50 | name specified by the second command line argument. | ||
51 | * The volume must contain the "background.png" image file. | ||
52 | * The volume must not contain a file or folder named "Applications". | ||
53 | * It might be necessary to "Enable access for assistive devices" | ||
54 | in System Preferences > Universal Access. | ||
55 | |||
56 | *) | ||
57 | |||
58 | on run argv | ||
59 | |||
60 | -- Read the first positional argument, the volume name. | ||
61 | set volumeName to item 1 of argv | ||
62 | |||
63 | -- Read the second positional argument, the app name. | ||
64 | set appName to item 2 of argv | ||
65 | |||
66 | tell application "Finder" to tell disk volumeName | ||
67 | -- Open the volume in a Finder window. | ||
68 | open | ||
69 | set theWindow to the container window | ||
70 | |||
71 | -- Tweak some options. | ||
72 | set current view of theWindow to icon view | ||
73 | set toolbar visible of theWindow to false | ||
74 | set statusbar visible of theWindow to false | ||
75 | |||
76 | -- Set window to position {150,150}, size {+600,+420}. | ||
77 | set bounds of theWindow to {150, 150, 750, 570} | ||
78 | |||
79 | -- Tweak some more options. | ||
80 | set viewOptions to the icon view options of theWindow | ||
81 | set arrangement of viewOptions to not arranged | ||
82 | set icon size of viewOptions to 128 | ||
83 | |||
84 | -- Make sure background.png is visible, so Finder can see it. | ||
85 | set bgPicPath to the quoted form of (the POSIX path of (it as alias) & "background.png") | ||
86 | do shell script ("SetFile -a v " & bgPicPath) | ||
87 | update without registering applications | ||
88 | |||
89 | -- Use background.png as the background picture. | ||
90 | set background picture of viewOptions to file "background.png" | ||
91 | |||
92 | -- Now set background.png to invisible, so the end user won't see it. | ||
93 | do shell script ("SetFile -a V " & bgPicPath) | ||
94 | |||
95 | -- Position the application file. | ||
96 | set position of item appName of theWindow to {138, 260} | ||
97 | |||
98 | -- Create and position an alias to the Applications folder. | ||
99 | set appAlias to make new alias file at theWindow to POSIX file "/Applications" | ||
100 | set name of appAlias to "Applications" | ||
101 | set position of appAlias to {470, 260} | ||
102 | |||
103 | -- Visually update the window so all the changes take effect. | ||
104 | update without registering applications | ||
105 | |||
106 | -- Pause briefly so we can admire the results. | ||
107 | delay 2 | ||
108 | end tell | ||
109 | |||
110 | end run | ||