Skip to main content

We are trying to deploy several dmg packages to a Mac via Automox.  I am setting them as required software.  Here is the script:
 

#!/bin/bash

DMG_PATH="/path/to/Avid_Link_25.5.1_Mac.dmg"
MOUNT_POINT=$(mktemp -d /tmp/avidlink.XXXXXX)

echo "🔧 Mounting DMG to $MOUNT_POINT..."
hdiutil attach "$DMG_PATH" -mountpoint "$MOUNT_POINT" -nobrowse -quiet

# Confirm mount succeeded
if ! -d "$MOUNT_POINT" ] || -z "$(ls -A "$MOUNT_POINT")" ]; then
echo "❌ Mount failed or mount point is empty. Exiting."
rmdir "$MOUNT_POINT"
exit 1
fi

# Locate the .pkg file
PKG_PATH=$(find "$MOUNT_POINT" -name "*.pkg" | head -n 1)

if b -z "$PKG_PATH" ]; then
echo "❌ No .pkg found. Unmounting and exiting."
hdiutil detach "$MOUNT_POINT" -quiet
rmdir "$MOUNT_POINT"
exit 1
fi

echo "📦 Installing package: $PKG_PATH"
sudo installer -pkg "$PKG_PATH" -target /

echo "🧹 Unmounting DMG..."
hdiutil detach "$MOUNT_POINT" -quiet
rmdir "$MOUNT_POINT"

echo "✅ Avid Link installed successfully."

The script gives this output.
 

 

Any ideas on why this isn’t working?

Grrr…  It’s not a dmg it’s a pkg file.  For this app.  I am still getting the same error on two other program installs using dmg files.

 


Hello!

 

Thanks for your post! I was trying to help by replicating this with a fresh download of Avid link, but I was only able to find a PKG file. 

 

Based on the error “Failed to Install” I am assuming that the DMG file was at least mounted without any errors. I would like to see if the “installer” command might have more output and we could try to troubleshoot further based on those details. 

 

Whenever a policy fails, only STDERR is what is sent to the console logs like the Activity Report. For that reason, I was wondering if you would be willing to redirect all output in the shell script to STDERR.

 

I am hoping that some extra information from the installer can help us to track down the problem. I am grateful for your patience and look forward to your response!


Avid link we got working.


Hello again!

I am glad that you were able to get the Avid installer working, but I also wanted to follow up regarding some other details I gathered using a required software policy.

 

While I was speaking to a teammate, they shared with me how required software policies might behave differently than a worklet because of how they handle exit codes. If we look at the DMG script you posted above as an example, because there are multiple exit code opportunities, this might be causing the script to exit early. For a required software policy it may be best to stick to a single line or command. 

 

While doing some testing, I was able to deploy an application, but I used significantly less logic in my bash script. (Mounting a DMG and copying data to the /Applications directory in a single command) At the suggestions of other teammates, if you do require a significant amount of logic it may be best to handle software deployment like this from a worklet. Is this at all possible for you? 

If you would prefer to handle this via a required software policy without relying on a worklet, I would advise reaching out to our support team directly. Thank you again!