Last active
May 9, 2017 23:17
-
-
Save krispayne/33d7d5034b925cc2e279f1b86f7f9483 to your computer and use it in GitHub Desktop.
Extension attribute to determine the installed printer driver version for a given Xerox printer model.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Determine the printer driver version using lpinfo | |
# I got the printer information by running: | |
# [kris@Kris-MacBook-Pro ~]$ lpinfo --make-and-model "7225" -m | |
# Library/Printers/PPDs/Contents/Resources/Xerox WorkCentre 7225.gz Xerox WorkCentre 7225, 3.123.0 | |
# [kris@Kris-MacBook-Pro ~]$ | |
# | |
# for an HP I have I used: | |
# [kris@Kris-MacBook-Pro ~]$ lpinfo --make-and-model "hp laserjet p4010" -m | |
# Library/Printers/PPDs/Contents/Resources/HP LaserJet P4010_P4510 Series.gz HP LaserJet P4010 Series | |
# [kris@Kris-MacBook-Pro ~]$ | |
# which did not return a version. YMMV. Printer driver makers DGAF. | |
printer="Xerox WorkCentre 7225" | |
driverversion=$(lpinfo --make-and-model "${printer}" -m | sed -n -e 's/^.*, //p') | |
if [[ ${driverversion} ]]; then | |
result=${driverversion} | |
else | |
result="Not Installed" | |
fi | |
echo "<result>$result</result>" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This assumes a structure of
/path/to/driver Driver Name, version
which isn't always the case:This works for my purpose (EA for Xerox driver) but if you want to do more
sed
/awk
magic to make it "universal" be my guest.