Created
August 8, 2013 17:33
-
-
Save nmcspadden/6186788 to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
# Variables. Edit these. | |
printername="shhs_gabrielle".sacredsf.org | |
location="SHHS Gabrielle" | |
gui_display_name=$location | |
address=$printername | |
driver_ppd="/Library/Printers/PPDs/Contents/Resources/Xerox WC 7556.gz" | |
# Populate these options if you want to set specific options for the printer. E.g. duplexing installed, etc. | |
option_1="XRLanFax=False" | |
option_2="XRTrays=FiveTraysHCTT" | |
option_3="XRFinisher=0CT" | |
option_4="XRHolePunch=23Unit" | |
option_5="XRMassStorage=True" | |
option_6="XRJobType=Secure" | |
currentVersion="3.0" | |
### Determine if receipt is installed ### | |
if [ -e /private/etc/cups/deployment/receipts/$printername.plist ]; then | |
storedVersion=`/usr/libexec/PlistBuddy -c "Print :version" /private/etc/cups/deployment/receipts/$printername.plist` | |
echo "Stored version: $storedVersion" | |
else | |
storedVersion="0" | |
fi | |
versionComparison=`echo "$storedVersion < $currentVersion" | bc -l` | |
# This will be 0 if the current receipt is greater than or equal to current version of the script | |
### Printer Install ### | |
# If the queue already exists (returns 0), we don't need to reinstall it. | |
/usr/bin/lpstat -p $printername | |
if [ $? -eq 0 ]; then | |
if [ $versionComparison == 0 ]; then | |
# We are at the current or greater version | |
exit 1 | |
fi | |
# We are of lesser version, and therefore we should delete the printer and reinstall. | |
/usr/sbin/lpadmin -x $printername | |
fi | |
# Now we can install the printer. | |
/usr/sbin/lpadmin \ | |
-p "$printername" \ | |
-L "$location" \ | |
-D "$gui_display_name" \ | |
-v lpd://"${address}" \ | |
-P "$driver_ppd" \ | |
-o "$option_1" \ | |
-o "$option_2" \ | |
-o "$option_3" \ | |
-o "$option_4" \ | |
-o "$option_5" \ | |
-o "$option_6" \ | |
-o printer-is-shared=false \ | |
-o printer-error-policy=abort-job \ | |
-E | |
# Enable and start the printers on the system (after adding the printer initially it is paused). | |
/usr/sbin/cupsenable $(lpstat -p | grep -w "printer" | awk '{print$2}') | |
# Create a receipt for the printer | |
mkdir -p /private/etc/cups/deployment/receipts | |
/usr/libexec/PlistBuddy -c "Add :version string" /private/etc/cups/deployment/receipts/$printername.plist | |
/usr/libexec/PlistBuddy -c "Set :version $currentVersion" /private/etc/cups/deployment/receipts/$printername.plist | |
# Permission the directories properly. | |
chown -R root:_lp /private/etc/cups/deployment | |
chmod -R 700 /private/etc/cups/deployment | |
exit 0 |
@nmcspadden @qpple I'm wondering about the same thing. Did you manage to configure a standard passcode?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi nmcspadden,
Does option_6="XRJobType=Secure" work for you ? For me the job is printed whiteout asking for a passcode.
How do you solve this ?
Q