servatrice/cmake/CMakeDMGSetup.script
SlightlyCircuitous 5f0ab2a177
CPack DMG Installer with Background Image (#4787)
* Set some CPack variables

WIP for DMG background image

* Use a .tif for background

* Add Background image and DS_Store script

Script is from https://www.kitware.com//creating-mac-os-x-packages-with-cmake/ with cmake.app changed to cockatrice.app

* Add position for all icons

* Adjust background size and icon position

This draws dbconverter off the screen as a hack to hide it, so hopefully it doesn't break.

* Add files via upload

* Change Icon Position

Icon position is probably relative to the window edge, not the edge of the screen so the numbers should be lower.

* Adjust Icon Position and Window Boundaries

Applescript seems to use the center of the icon rather than the left corner so the coordinates need to be adjusted by 64 px. 

The finder window counts the 22 px of the title bar in the window size so 22 must be added to the fourth coord of position to fit the entire image.

* Fix spelling of Servatrice

* Satifsfy Code Style

* Use vector format (eps)

* Delete background.tif

* Use vector format (eps)

* Use the right file extention in the script

* Point to svg

* Use svg

* Add svg for background image

* Delete background.eps

* Use plain SVG, adjust text

* Move applescript to /cmake

* Move background to /cmake

* Point CPack to /cmake

background and applescript now reside there

* Revert to .tif

* Use compressed .tif

* Use more specific file name

* Script expects .background:background.tif
2023-04-29 23:13:01 -04:00

55 lines
1.5 KiB
Text

on run argv
set image_name to item 1 of argv
tell application "Finder"
tell disk image_name
-- wait for the image to finish mounting
set open_attempts to 0
repeat while open_attempts < 4
try
open
delay 1
set open_attempts to 5
close
on error errStr number errorNumber
set open_attempts to open_attempts + 1
delay 10
end try
end repeat
delay 5
-- open the image the first time and save a DS_Store with just
-- background and icon setup
open
set current view of container window to icon view
set theViewOptions to the icon view options of container window
set background picture of theViewOptions to file ".background:background.tif"
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 128
delay 5
close
-- next setup the position of the app and Applications symlink
-- plus hide all the window decoration
open
update without registering applications
tell container window
set sidebar width to 0
set statusbar visible to false
set toolbar visible to false
set the bounds to { 400, 100, 1400, 922 }
set position of item "Cockatrice.app" to { 139, 214 }
set position of item "Oracle.app" to { 139, 414 }
set position of item "Servatrice.app" to { 139, 614 }
set position of item "dbconverter.app" to { 1400, 1400 }
set position of item "Applications" to { 861, 414 }
end tell
update without registering applications
delay 5
close
end tell
delay 1
end tell
end run