Last active
August 29, 2015 14:07
-
-
Save bochoven/6dec8309e0e31d5b0c74 to your computer and use it in GitHub Desktop.
Munki managed printer
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>autoremove</key> | |
<false/> | |
<key>catalogs</key> | |
<array> | |
<string>production</string> | |
</array> | |
<key>description</key> | |
<string>Setup for Multifunctional Color Printer.</string> | |
<key>display_name</key> | |
<string>Ricoh Color Printer Setup</string> | |
<key>minimum_os_version</key> | |
<string>10.6.0</string> | |
<key>name</key> | |
<string>ricoh_color</string> | |
<key>installer_type</key> | |
<string>nopkg</string> | |
<key>preinstall_script</key> | |
<string>#!/bin/sh | |
# (c) 2010 Walter Meyer SUNY Purchase College | |
# Script to install and setup printers on a Mac OS X system in a "Munki-Friendly" way. | |
# Make sure to install the required drivers first! | |
# Variables. Edit these. | |
printername="VU_Ricoh_Color_Printer_PS" | |
version="1.0.3" | |
location="Follow Me" | |
gui_display_name="VU Multifunctional Color" | |
address="smb://OUR_PRINTSERVER_ADDRESS/$printername" | |
driver_ppd="/Library/Printers/PPDs/Contents/Resources/RICOH Aficio MP C4502.gz" | |
# Populate these options if you want to set specific options for the printer. E.g. duplexing installed, etc. | |
option_1="Finisher=FinKINGB" | |
option_2="KMDuplex=Double" | |
option_3="OptionTray=2Cassette" | |
option_4="LargeCapacityTray=Installed" | |
option_5="RIPaperPolicy=NearestSizeAdjust" | |
# Uninstall script | |
uninstall_path="/private/etc/cups/printers_deployment/uninstalls" | |
uninstall_script="${uninstall_path}/${printername}-${version}.sh" | |
### Printer Install ### | |
# In case we are making changes to a printer we need to remove an existing queue if it exists. | |
# We also remove the uninstall scripts | |
/usr/bin/lpstat -p | grep -w "$printername" | |
if [ $? -eq 0 ]; then | |
/usr/sbin/lpadmin -x "$printername" | |
/usr/bin/srm "${uninstall_path}/${printername}"* | |
fi | |
# Now we can install the printer. | |
/usr/sbin/lpadmin \ | |
-p "$printername" \ | |
-L "$location" \ | |
-D "$gui_display_name" \ | |
-v "$address" \ | |
-P "$driver_ppd" \ | |
-o "$option_1" \ | |
-o "$option_2" \ | |
-o "$option_3" \ | |
-o "$option_4" \ | |
-o "$option_5" \ | |
-o printer-is-shared=false \ | |
-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 an uninstall script for the printer. | |
mkdir -p "${uninstall_path}" | |
echo "#!/bin/sh" > "$uninstall_script" | |
echo '/usr/sbin/lpadmin -x "'$printername'"' >> "$uninstall_script" | |
echo '/usr/bin/srm "'${uninstall_path}/${printername}'"*' >> "$uninstall_script" | |
# Permission the directories properly. | |
chown -R root:_lp /private/etc/cups/printers_deployment | |
chmod -R 700 /private/etc/cups/printers_deployment | |
exit 0 | |
</string> | |
<key>installcheck_script</key> | |
<string>#!/bin/sh | |
# Check if the queue exists | |
if lpstat -p VU_Ricoh_Color_Printer_PS; then | |
# Check for correct version | |
if [ -e /etc/cups/printers_deployment/uninstalls/VU_Ricoh_Color_Printer_PS-1.0.3.sh ]; then | |
# No install needed | |
exit 1 | |
fi | |
fi | |
# Signal installation is necessary | |
exit 0 | |
</string> | |
<key>unattended_install</key> | |
<true/> | |
<key>requires</key> | |
<array> | |
<string>RicohPrinterDrivers</string> | |
</array> | |
<key>version</key> | |
<string>1.0.3</string> | |
<key>uninstall_method</key> | |
<string>uninstall_script</string> | |
<key>uninstall_script</key> | |
<string>#!/bin/sh | |
/etc/cups/printers_deployment/uninstalls/VU_Ricoh_Color_Printer_PS-1.0.3.sh | |
</string> | |
<key>uninstallable</key> | |
<true/> | |
</dict> | |
</plist> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment