Hello Everyone.
My name is Chris. I made this handy script that mounts cached DMGs and installs the contents silently for users. I know this isn't a big deal or anything but I wanted to contribute something for those learning to script for bash or may be in a packaging position for JSS for the first time and need something to reference to help them along. Please feel free to use this to your hearts content. The example below is for JRE10
-Cheers
#!/bin/bash
##########################################################################
# Install Application from DMG in Jamf Waiting ROOM
# Created By: Christopher Glover
# Date: 03/26/2018
#
# Disclaimer:
# These scripts come without warranty of any kind. Use them at your own risk.
# I assume no liability for the accuracy, correctness, completeness, or usefulness of any information
# provided by this site nor for any sort of damages using these scripts may cause.
##########################################################################
# Changes directory to '/library/Application Support/JAMF/Waiting Room/' this is where JSS storred cached files.
cd /library/Application Support/JAMF/Waiting Room/
#Mounts Downloaded DMG within the Jamf Waiting room
hdiutil attach -nobrowse jre-10_osx-x64_bin.dmg
#Changes Directory to '/Volumes/Java 10.app/Contents/Resources' (this is where the PKG lives with its dependancies)
cd /Volumes/Java 10/Java 10.app/Contents/Resources/
#Calls the installer and installs it to the root of the dirve which is the default
installer -pkg JavaAppletPlugin.pkg -target /
#Backs out of the DMG (This has to happen or else the DMG resource will be busy and cant be dismounted
cd /
#Sleeps for 20 seconds to finish up any lingering processes from installer
sleep 20
#Detatches the DMG
hdiutil detach /Volumes/Java 10/
#Changes directory to '/library/Application Support/JAMF/Waiting Room/' this is where JSS storred cached files
cd /library/Application Support/JAMF/Waiting Room/
echo "cleaning up"
#Cleans Up the dmg so it doesnt take up space on machine
rm jre-10_osx-x64_bin.dmg
#cleans out the XML
rm jre-10_osx-x64_bin.dmg.cache.xml
exit 0