Question
In Deployment Solution 6.8 (or newer) and in Software Delivery for Macintosh, how do I install an application from a DMG package to Mac OS X client computer?
Answer
For Deployment Solution:
- Copy the .dmg package file to your eXpress share. For ease of comprehension let’s say its name is "VineServer2.2.dmg"
- Create a new job in Deployment Solution Win32 console.
- In this new job, add a "Copy file to…" command and select your .dmg file. The source path should be something like
.\Images\Mac\MacVNC_server\VineServer2.2.dmg
The destination path should be an accessible folder on the target Mac computer such as:
\Users\Shared\VineServer2.2.dmg
- Add a "Run script…" command, check the Mac OS X radio button and type this script:
hdiutil attach /Users/Shared/VineServer2.2.dmg
ditto -rsrc /Volumes/"Vine Server"/ /Applications/
hdiutil info | grep -w 'Vine Server' | awk '{ print $1 }' | xargs hdiutil detach
rm /Users/Shared/VineServer2.2.dmg
- The job is now ready to run.
For Software Delivery for Macintosh:
- Create a shell script that does the following. The file must have macintosh line endings - not windows or unix.
hdiutil attach /<path to file>/<filename>.dmg
ditto -rsrc /Volumes/<app name>/ /Applications/
hdiutil info | grep -w '<mounted volume name>' | grep -v 'image' | awk '{ print $1 }' | xargs hdiutil detach
rm /<path to file>/<filename>.dmg
- Create a package and policy on the NS server that contains the dmg file and the above script, as described in KB# 24411.
Notes:
- Change the name and paths accordingly to the actual file you are using. In the first line, change the file name; in the second line, modify the /Volumes/… path according to the path displayed by the package when it’s mounted on the Mac. Make a test before creating the script to get the volume name of your .dmg file. Check lines 3 and 4 to meet the aforementioned requirements.
- It is usually safe to use the \Users\Shared\ path to store temporary files. The Deployment agent already has the security permissions to use this folder.
- If the .dmg package has a license screen with an Agree button, it will not mount automatically and installation in Mac OS Applications folder will fail.
- To find the "<mounted volume name>", run "hdiutil info". The results will list a different section for each mounted dmg file. The line with the <mounted volume name> will being with a /dev device name, the Apple HFS entry followed by the volume name of the dmg file. The results will also contain the dmg name on the image-path and image-alias entries, hence, the need for "grep -v 'image'".