package.applescript.in 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. on run (volumeName)
  2. tell application "Finder"
  3. tell disk (volumeName as string)
  4. open
  5. set theXOrigin to @_DMG_WINDOW_X@
  6. set theYOrigin to @_DMG_WINDOW_Y@
  7. set theWidth to @_DMG_WINDOW_WIDTH@
  8. set theHeight to @_DMG_WINDOW_HEIGHT@
  9. set theBottomRightX to (theXOrigin + theWidth)
  10. set theBottomRightY to (theYOrigin + theHeight)
  11. set dsStore to "\"" & "/Volumes/" & volumeName & "/" & ".DS_STORE\""
  12. tell container window
  13. set current view to icon view
  14. set toolbar visible to false
  15. set statusbar visible to false
  16. set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
  17. set statusbar visible to false
  18. set position of every item to {theBottomRightX + 100, 100}
  19. end tell
  20. set opts to the icon view options of container window
  21. tell opts
  22. set icon size to @_DMG_ICON_SIZE@
  23. set text size to @_DMG_TEXT_SIZE@
  24. set arrangement to not arranged
  25. end tell
  26. set background picture of opts to file ".background:@CPACK_DMG_BACKGROUND_FILENAME@"
  27. set position of item "@[email protected]" to {@_DMG_OBS_X@, @_DMG_OBS_Y@}
  28. set position of item "Applications" to {@_DMG_APP_LINK_X@, @_DMG_APP_LINK_Y@}
  29. close
  30. open
  31. -- Force saving of the size
  32. delay 1
  33. tell container window
  34. set statusbar visible to false
  35. set the bounds to {theXOrigin, theYOrigin, theBottomRightX - 10, theBottomRightY - 10}
  36. end tell
  37. end tell
  38. delay 1
  39. tell disk (volumeName as string)
  40. tell container window
  41. set statusbar visible to false
  42. set the bounds to {theXOrigin, theYOrigin, theBottomRightX, theBottomRightY}
  43. end tell
  44. end tell
  45. --give the finder some time to write the .DS_Store file
  46. delay 3
  47. set waitTime to 0
  48. set ejectMe to false
  49. repeat while ejectMe is false
  50. delay 1
  51. set waitTime to waitTime + 1
  52. if (do shell script "[ -f " & dsStore & " ]; echo $?") = "0" then set ejectMe to true
  53. end repeat
  54. log "waited " & waitTime & " seconds for .DS_STORE to be created."
  55. end tell
  56. end run