Print Manager is an OS X client application developed to assist end users in the installation of print drivers and enterprise networked printers. Both the print drivers and the printer listing are managed by an administrator and provided to the application via two (or more) plists that reside on a company web server. The first plist contains a list of print drivers required to be installed and the second contains a listing of available printers. Additional plists can be included to separate functional groupings of printers (this requires minor user interface and code changes). Print Manager includes the following additional features:
- Sparkle updating (using either the old signing method or by checking the Apple Developer ID code signature)
- Network availability checking before attempting to download and install anything
- Verification of downloaded print drivers via md5 checksums, and prompts to attempt redownloads of packages that fail verification
- Retina display support
- OS X version compatibility of 10.6.8-10.8
Find "school.edu" in the AppDelegate.applescript file and follow the instructions in the comments for making required edits. Line numbers aren't listed here as they're subject to change with code updates. Most changes involve simply pointing the application to correct URLs.
The text on both the welcome screen and the error screen needs changed to something appropriate for your organization.
Your company web server must also host at least two plists. The first is titled PrintDrivers.plist
and the second is titled Printers.plist
. Example plists are provided in the Example Plists folder. The PrintDrivers.plist
contains an array of dicts like the following:
<dict>
<key>Name</key>
<string>Xerox</string>
<key>File</key>
<string>/Library/Printers/Xerox/PDEs/XeroxFeatures.plugin</string>
<key>Version</key>
<string>2.94.3</string>
<key>Version Location</key>
<string>/Library/Printers/Xerox/PDEs/XeroxFeatures.plugin/Contents/Info.plist</string>
<key>URL</key>
<string>http://school.edu/print-drivers/XeroxPrintDriver-2.94.3.pkg</string>
<key>MD5</key>
<string>f76177fee5fd07e3fc8e9bbf8a51ffff</string>
<key>Optional Installer Message</key>
<string></string>
</dict>
Descriptions of the keys are as follows:
- Name - This is used on the downloading and installation screens of the application. The labels have text of "Downloading xxxxxx driver package..." and "Installing xxxxxx drivers...". The value of the Name key is used to fill in xxxxxx.
- File - This is any file that is installed by the driver package. The application checks for this file before checking for an installed version.
- Version - This is used in combination with the next key, Version Location. The Version Location is checked for either a CFBundleShortVersionString key or a PackageVersion key. The value of the Version key is checked against the installed version. If it's less than the Version key, it is assumed the end user doesn't have the latest version of the print driver(s).
- Version Location - This is where the application should look for the installed version of the print driver package.
- URL - This is where the application can download the print driver package from.
- MD5 - This is the checksum that the application should verify against when the driver package has finished downloading.
- Optional Installer Message - This text is used to populate a label underneath the installation progress bar on the installation view of the application. This is useful for messages like "This install may take several minutes. Please be patient." for lengthy driver installations.
The Printers.plist
file contains an array of dicts like the following:
<dict>
<key>Name</key>
<string>Printer 1</string>
<key>Queue Name</key>
<string>Printer1</string>
<key>Location</key>
<string>The interwebs</string>
<key>Driver Path</key>
<string>/Library/Printers/PPDs/Contents/Resources/HP\ LaserJet\ 4050\ Series.gz</string>
<key>URL</key>
<string>url://printserver.school.edu/Printer1</string>
</dict>
Descriptions of the keys are as follows:
- Name - This is used in the table view shown to the end user. This is the user friendly name of the printer.
- Queue Name - This is the CUPS queue name.
- Location - This is the location of the printer, as displayed to the end user in System Preferences.
- Driver Path - This is the location on the filesystem of the print driver for the printer.
- URL - This is the URL of the printer. Depending on your environment, this might be "smb://" or "popup://" or even "lpd://"
Print Manager loops through both plists each time it runs, so requiring additional print drivers and/or updating the list of available printers is as simple as editing one or both of the plists.
If you'd like to separate printers by functional groups, the easiest way to do this is to add menu bar items under "View" for each group. Each menu bar item would be linked to a property that holds a true or false value. Before populating the table listing of available printers, the application would check the values of these properties and only show printers for groups that are checked. Each group would have its own plist on the company web server.
A background image that includes a company logo should be added to the different views via modifying the existing NSImageViews. There are two Photoshop files included in the Background Images folder of the project. One is for regular displays and the other is for retina displays.
An application icon should be added.
The version of sparkle included with the project has the ability to verify application updates based on the Apple Developer ID code signature, or by signing updates with a key pair of which the public key is included inside the application bundle. See "Publishing an Update" on Andy Matuschak's GitHub for more information about publishing updates via Sparkle. The application, at a minimum, needs the SUFeedURL
key of its Info.plist file modified to reflect the location of your appcast.
Because the application loops through every driver listed in the PrintDrivers.plist
file and downloads and installs each one, it's important that at least this file be served over https. If a certificate verification problem occurs during the TLS negotiation, curl will exit with an error which will cause the application to present the error view (and not download and install the drivers).
Downloaded drivers are verified against the MD5 checksums listed in the PrintDrivers.plist
file. If you can ensure the integrity of this file at the time of download, you can be reasonably certain that the MD5 checksums that the downloads are being verified against are valid.
Sparkle updates are signed using either a custom private key or the private key linked to an Apple Developer ID Application certificate. They're verified using either a public key embedded inside the application or by verifying the Apple Developer ID code signature. More specifically, Sparkle will verify that the new version's author matches the old version's author. If you choose to use the custom keypair, because you already have the public key embedded in the application at your disposal, you could be clever and possibly sign your plist(s) and verify them using that key as well.
- All required drivers in the
PrintDrivers.plist
file are downloaded and installed before the printer listing is shown to the end user. - The options portion of the
lpadmin
command is currently hardcoded as-o printer-is-shared=false
. With minimal code changes and an extra key added to thePrinters.plist
file, this options string could become dynamic. - If an end user clicks away from the application during a driver download or install, clicking the Dock icon for the application will not bring the window back to the forefront until the download or installation has finished. Using Mission Control or Expose can bring the window back. This is due to the locking nature of AppleScript Objective-C, but could be improved if code improvements were made to use NSTasks instead of "do shell script"s.
This software is released under the MIT license.
Copyright (c) 2013 Mike Boylan
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.