Posted on 10-04-2012 03:23 PM
Hello,
If you attempt to use the installPKGfromDMG.sh script from November 2011 Resource Kit and follow the inline directions, the install will fail.
In the InstallPKGfromDMG.sh (Kit>All Tools>Adobe), the procedure in the comments states:
11. Enter the name of the original PKG in the Parameter 4 field. # Note: You must enter the exact name of the PKG in the Parameter 4 field. If you need # to verify the name of the PKG, you can mount the DMG that it is wrapped inside.
In actual use, you need to supply the name of the DMG, not the PKG. If you use the PKG name, the installer will fail with a file not found error.
Please note that the installPKGfromDMG.sh script available for download at this link is correct: https://jamfnation.jamfsoftware.com/viewProductFile.html?id=3&fid=547
jkb
Posted on 10-04-2012 05:18 PM
Yea, that one tripped us up a little...
https://jamfnation.jamfsoftware.com/article.html?id=161
Posted on 03-07-2013 12:32 PM
I've just built one and tried it for the first time. Here's what I get:
Script result: Variable "dmgName" value is set to: Adobe CS5 Design Standard.dmg
Mounting the DMG Adobe CS5 Design Standard.dmg...
hdiutil: attach: extra image argument "CS5" - "/Library/Application Support/JAMF/Waiting Room/Adobe" already specified
Usage: hdiutil attach [options] <image>
hdiutil attach -help
DMG mounted successfully as volume on device .
Installing Package from mount path ...
There is a problem with your syntax.
Error: No package was specified
Type "jamf help" for more information.
There was an error installing the package. Exit Code: 1
Unmounting disk ...
hdiutil: detach failed - No such file or directory
rm: /Library/Application Support/JAMF/Waiting Room/Adobe: No such file or directory
rm: CS5: No such file or directory
rm: Design: No such file or directory
rm: Standard.dmg: No such file or directory
So it says it's failing not knowing where the .pkg file is. I'm using Version: 1.0 - Created by Nick Amundsen on July 22, 2011.
My .pkg is named "Adobe CS5 Design Standard_Install.pkg" and the script does contain:
# Find the PKG in the DMG
packageName=ls $mountVolume | grep "pkg"
Anyone see something obvious I'm doing wrong? Thanks for reading
- Scott
Posted on 03-07-2013 12:50 PM
It has been quite some time since I have used that script but the part below seems like something you would see if the DMG isn't actually getting mounted:
hdiutil: attach: extra image argument "CS5" - "/Library/Application Support/JAMF/Waiting Room/Adobe" already specified
Usage: hdiutil attach [options] <image>
hdiutil attach -help
I would try it again with the DMG file NOT containing any spaces.
Posted on 03-07-2013 01:09 PM
Could it be because I've named it using spaces? "Adobe CS5 Design Standard_Install.pkg" If it's in a shell script, does it need to have the spaces "escaped" or removed?
I'll try that but feedback would be welcome.
- Scott
Posted on 03-07-2013 01:26 PM
From the log it looks like it is because the DMG has a space in it. Try taking the spaces out of that first. I'm not sure if the PKG can have spaces or not.
Posted on 03-07-2013 03:22 PM
it's definitely because of the spaces. Either take them out or escape them with a backslash in the script.
any path given in a bash script will need to have spaces escaped.
Posted on 03-08-2013 02:56 AM
spaces + scripts = bad
Posted on 03-08-2013 07:05 AM
On a related note (using this script to install Adobe PKGs) we setup our Distribution Point as HTTP after fighting with this same issue. It has made things quite a bit easier for us. You can just use the Adobe PKG instead of wrapping it up in the DMG and using that script. Not sure if that is an option for you but just thought I'd throw that out there.
Posted on 03-06-2015 02:07 PM
I was looking into this earlier this week, as we were trying to install Java for OS X 2014-001 after upgrading users from Mountain Lion to Yosemite. (The Oracle provided DMG mounts to a volume with spaces, even though the .dmg and associated .pkg files do not have them.)
After playing around with the script, I found that you can change the field separator to Tab instead of Space and it solves the issue with a "spaced mount volume." I also had to wrap $mountVolume in quotes going forward, and I added a bit more logging just to verify what was happening when the script ran.
Here's the version of the awk line that I came up with - also very minimally tested:
mountVolume=`echo "$mountResult" | grep Volumes | awk -F ' ' '{print $3}'`
Since I don't want to overlook any of the necessary changes, I'll just post the "Script contents - Do nnot modify below this line" contents here:
# Verify Variables
verifyVariable dmgName
# Mount the DMG
log "Mounting the DMG $dmgName..."
mountResult=`/usr/bin/hdiutil mount -private -noautoopen -noverify /Library/Application Support/JAMF/Waiting Room/$dmgName -shadow`
log "Mount Result is $mountResult..."
mountVolume=`echo "$mountResult" | grep Volumes | awk -F ' ' '{print $3}'`
log "Mount Volume is $mountVolume..."
mountDevice=`echo "$mountResult" | grep disk | head -1 | awk '{print $1}'`
log "Mount Device is $mountDevice..."
if [ $? == 0 ]; then
log " DMG mounted successfully as volume $mountVolume on device $mountDevice."
else
log "There was an error mounting the DMG. Exit Code: $?"
fi
# Find the PKG in the DMG
packageName=`ls "$mountVolume" | grep "pkg"`
# Install the PKG wrapped inside the DMG
log "Installing Package $packageName from mount path $mountVolume..."
/usr/sbin/jamf install -path "$mountVolume" -package $packageName
if [ $? == 0 ]; then
log " Package successfully installed."
else
log "There was an error installing the package. Exit Code: $?"
fi
# Unmount the DMG
echo "Unmounting disk $mountDevice..."
hdiutil detach "$mountDevice" -force
# Delete the DMG
/bin/rm /Library/Application Support/JAMF/Waiting Room/$dmgName
if [ $? == 0 ]; then
log "Script completed successflly using volume $mountVolume on device $mountDevice."
else
log "There was an error installing the stuff in the DMG. Exit Code: $?"
fi
Posted on 03-08-2015 03:21 PM
I find myself not using this script any longer, now that Casper Admin will zip non-flat PKG files before uploading them to the non-Mac JSSes.
Posted on 03-09-2015 04:03 AM
We found the script was mounting the dmg before the download had completed so we have added a sleep to the start of the script to give the d/l time to finish.