The .dmg disk image is a particularly tricky format for Addigy to handle, and the Addigy platform does not have a native method for installing files from .dmg files. The main for this is that a .dmg file must be mounted by the macOS filesystem before the installation files contained within it can be examined and installed.
For this reason, Addigy recommends that you remove .pkg installations from within the .dmg and upload it individually when at all possible.
However, sometimes software will require installation from within the .dmg volume. In this case, you will need to generate your own Installation script. The other steps for this Custom Software should mirror the .pkg installation described in our article Creating Custom Software.
As an example, let's install a large set of fonts. Let's say there are 100 font files in this .dmg volume, and uploading and installing them individually isn't a feasible solution. Instead, we'll be working just with a CustomFonts.dmg file that contains all the individual fonts.
I've entered the basic information of the Custom Software item, and already uploaded the .dmg file. All that's left are the scripts.
To install from a .dmg we need to accomplish these three major steps:
1) Mount the .dmg file.
2) Install files and software from the mounted volume.
3) Unmount the .dmg file.
Steps 1 and 3 are largely the same for every .dmg installation, just changing the paths for the commands to work. However, for step 2, our fonts must be moved to the correct macOS location.
Here's the Installation script that performs all these steps:
hdiutil attach -nobrowse "/Library/Addigy/ansible/packages/Custom Fonts (1.0.0)/CustomFonts.dmg" chmod -R 644 /Volumes/Fonts/* cp /Volumes/Fonts/* /Library/Fonts/ diskutil unmount /Volumes/Fonts
Remember, you will also need to update the Library and Volumes paths in the example above to point to your specific files and their destinations.
Note: the -nobrowse option ensures that the end-user does not see the .dmg file mounted in Finder if they are logged into the device.
The Condition script for this software is quite simple. It checks to see if one of the fonts we installed is in the correct folder. We assume that if one font is still there, then the whole set of fonts is still successfully installed.
if [ -f '/Library/Fonts/Sentinel-SemiboldItal.otf' ]; then exit 1 fi exit 0
The Condition script for your Custom Software will likely be very different, but even a simple script similar to this which checks for existing files can serve as a perfectly good Condition.
If you'd like to ensure the removal of your Custom Software when a device is removed from the appropriate policy, then you may write a Removal script.