We have a build process that is now doing the common layout for distributed DMGs. This is done in a way that I've seen in many places -- the DMG is attached, then Finder does its job via osascript. However, the script must refer to the mounted image by its volume name, and AFAICT, these are not unique. Since the machine that is doing this work is not dedicated for that, I worry that it might already have a mounted image by the same name (likely, since the person who works with this machine is a client of the generated DMGs too).
Is there some way to refer to a disk uniquely in the osascript if, for example, I know its device or its mount point? Or maybe there's some other way to resolve this, like attaching an image with a different volname so I can pass some randomly generated name?
(I'm surprised that I didn't see any mention of this on the web, so maybe I'm missing something more obvious.)
<image name>.dmg
or/Volumes/<volume name>
?tell disk <volname>
and that name might not be unique.