Skip to content

Instantly share code, notes, and snippets.

@rtrouton
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rtrouton/8830790 to your computer and use it in GitHub Desktop.
Save rtrouton/8830790 to your computer and use it in GitHub Desktop.
Script for use with Casper's Self Service when deploying Canon printers. Script checks /Library/Printers/Canon/CUPSPS2/Utilities/Canon CUPS PS Printer Utility.app/Contents/Info.plist for the CFBundleVersion key value. If the value returned is less than the version of the current drivers, the print drivers are installed by a Casper policy before …
#!/bin/bash
# Check /Library/Printers/Canon/CUPSPS2/Utilities/Canon CUPS PS Printer Utility.app/Contents/Info.plist
# for the CFBundleVersion key value. It should match the version of the installed drivers.
installed_driver=$(defaults read "/Library/Printers/Canon/CUPSPS2/Utilities/Canon CUPS PS Printer Utility.app/Contents/Info" CFBundleVersion)
# Specify the current driver version
# by setting parameter 4 in the script
# on the JSS
driver_version="$4"
if [[ ${installed_driver} > ${driver_version} ]]; then
echo "Canon PS $installed_driver Print Drivers installed"
fi
if [[ ${installed_driver} == ${driver_version} ]]; then
echo "Canon PS $driver_version Print Drivers installed"
fi
if [[ ${installed_driver} < ${driver_version} ]]; then
echo "Canon PS $driver_version Print Drivers not installed. Installing Canon PS $driver_version Print Drivers"
jamf displayMessage -message "The needed Canon printer drivers have not been detected. Installing Canon PS $driver_version Print Drivers before adding the requested printer."
jamf policy -trigger companycanondrivers
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment