Thanks to @mm2270 and @rtrouton I have taken Mike's update script and Rich's adobe flash update script and figured out how to make the Microsoft Silverlight script.
#!/bin/sh
# Silverlight Lastest Version URL
###############################
silLightCheckURL="http://www.microsoft.com/getsilverlight/locale/en-us/html/Microsoft%20Silverlight%20Release%20History.htm"
URL="${silLightCheckURL}"
###############################
# Determine OS version
###############################
osvers=$(sw_vers -productVersion | awk -F. '{print $2}')
# Current Microsoft Silverlight Version
###############################
curr_Vers=$( curl -sf "${URL}" 2>/dev/null | grep -m1 "Silverlight 5 Build" | awk -F'[>|<]' '{print $2}' | tr ' ' '
' | awk '/Build/{getline; print}' )
# Download URL Microsoft Silverlight Version
###############################
download_url=$( curl -sfA "$UGENT" "http://go.microsoft.com/fwlink/?LinkID=229322" | awk -F'"' '{print $2}' | sed '/^$/d' )
sl_dmg="silverlight.dmg"
if [[ ${osvers} -lt 6 ]]; then
echo "Buy a new Mac!"
fi
if [[ ${osvers} -ge 6 ]]; then
# Download the latest Microsoft Silverlight software disk image
/usr/bin/curl --output "$sl_dmg" "$download_url"
# Specify a /tmp/silverlight.XXXX mountpoint for the disk image
TMPMOUNT=`/usr/bin/mktemp -d /tmp/silverlight.XXXX`
# Mount the latest Silverlight disk image to /tmp/silverlight.XXXX mountpoint
hdiutil attach "$sl_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen
pkg_path="$(/usr/bin/find $TMPMOUNT -maxdepth 1 ( -iname *Silverlight*.pkg -o -iname *Silverlight*.mpkg ))"
# Before installation on Mac OS X 10.7.x and later, the installer's
# developer certificate is checked to see if it has been signed by
# Microsoft's developer certificate. Once the certificate check has been
# passed, the package is then installed.
if [[ ${pkg_path} != "" ]]; then
if [[ ${osvers} -ge 7 ]]; then
signature_check=`/usr/sbin/pkgutil --check-signature "$pkg_path" | awk /'Developer ID Installer/{ print $5 }'`
if [[ ${signature_check} = "Microsoft" ]]; then
# Install Microsoft Silverlight from the installer package stored inside the disk image
/usr/sbin/installer -dumplog -verbose -pkg "${pkg_path}" -target "/"
fi
fi
# On Mac OS X 10.6.x, the developer certificate check is not an
# available option, so the package is just installed.
if [[ ${osvers} -eq 6 ]]; then
# Install Microsoft Silverlight from the installer package stored inside the disk image
/usr/sbin/installer -dumplog -verbose -pkg "${pkg_path}" -target "/"
fi
fi
# Clean-up
# Unmount the Microsoft Silverlight disk image from /tmp/silverlight.XXXX
/usr/bin/hdiutil detach "$TMPMOUNT"
# Remove the /tmp/silverlight.XXXX mountpoint
/bin/rm -rf "$TMPMOUNT"
# Remove the downloaded disk image
/bin/rm -rf "$SilverlightDMG"
fi
exit 0