I am following a tutorial on how to create a DMG on the command line there is an applescript which you can find here which sorts the layout of the DMG. The problem is that I can't get it to work the way I want it and position the apps and choose the window size within the DMG properly but I can do it manually on a rw DMG and then make it read only. Is there anyway to export these positions so I do not have to do it manually? Thank you.
I struggled a lot with building my DMG just the way I want it, then I've found dmgbuild. It basically lets you configure every possible setting with ease.
dmgbuildis a command line tool to create Mac OS X disk images (aka .dmg files). While it is possible to create disk images easily enough from the command line using the hdiutil program that ships with Mac OS X, there is no easy way to configure the appearance of the resulting disk image when the user opens it. Some people have used AppleScript to automate Finder to adjust the appearance, but since Finder saves its .DS_Store files asynchronously, it is hard to guarantee that the changes will actually be saved when you want them to be. It also means that you need a GUI session, with Finder running, in order to build your disk image.
dmgbuilddoes not rely on Finder; nor does it rely on deprecated APIs (like the Alias Manager functions). Instead, it uses the ds_store and mac_alias Python modules, which know how to construct the relevant data in Python code.