Skip to content

Instantly share code, notes, and snippets.

@pchan37
Last active September 12, 2018 23:44
Show Gist options
  • Save pchan37/4f818ea85334c68c8d45e0402d7b2018 to your computer and use it in GitHub Desktop.
Save pchan37/4f818ea85334c68c8d45e0402d7b2018 to your computer and use it in GitHub Desktop.
Install sbu printer on Linux (Tested on Ubuntu 16.04)
#!/bin/bash -e
PRINTER_PPD_FILE_CONTENT='*PPD-Adobe: "4.3"\n*%\n*% For information on using this, and to obtain the required backend\n*% script, consult http://www.openprinting.org/\n*%\n*% This file is published under the GNU General Public License\n*%\n*% PPD-O-MATIC (4.0.0 or newer) generated this PPD file. It is for use with\n*% all programs and environments which use PPD files for dealing with\n*% printer capability information. The printer must be configured with the\n*% "foomatic-rip" backend filter script of Foomatic 4.0.0 or newer. This\n*% file and "foomatic-rip" work together to support PPD-controlled printer\n*% driver option access with all supported printer drivers and printing\n*% spoolers.\n*%\n*% To save this file on your disk, wait until the download has completed\n*% (the animation of the browser logo must stop) and then use the\n*% "Save as..." command in the "File" menu of your browser or in the\n*% pop-up manu when you click on this document with the right mouse button.\n*% DO NOT cut and paste this file into an editor with your mouse. This can\n*% introduce additional line breaks which lead to unexpected results.\n*%\n*% You may save this file as 'Xerox-Phaser_5500DT-Postscript.ppd'\n*%\n*%\n*FormatVersion: "4.3"\n*FileVersion: "1.1"\n*LanguageVersion: English\n*LanguageEncoding: ISOLatin1\n*PCFileName: "POSTSCRI.PPD"\n*Manufacturer: "Xerox"\n*Product: "(Phaser 5500DT)"\n*cupsVersion: 1.0\n*cupsManualCopies: True\n*cupsModelNumber: 2\n*cupsFilter: "application/vnd.cups-postscript 100 foomatic-rip"\n*cupsFilter: "application/vnd.cups-pdf 0 foomatic-rip"\n*%pprRIP: foomatic-rip other\n*ModelName: "Xerox Phaser 5500DT"\n*ShortNickName: "Xerox Phaser 5500DT Postscript"\n*NickName: "Xerox Phaser 5500DT Foomatic/Postscript"\n*PSVersion: "(3010.000) 550"\n*PSVersion: "(3010.000) 651"\n*PSVersion: "(3010.000) 652"\n*PSVersion: "(3010.000) 653"\n*PSVersion: "(3010.000) 704"\n*PSVersion: "(3010.000) 705"\n*PSVersion: "(3010.000) 800"\n*PSVersion: "(3010.000) 815"\n*PSVersion: "(3010.000) 850"\n*PSVersion: "(3010.000) 860"\n*PSVersion: "(3010.000) 861"\n*PSVersion: "(3010.000) 862"\n*PSVersion: "(3010.000) 863"\n*PSVersion: "(3010.000) 864"\n*PSVersion: "(3010.000) 870"\n*LanguageLevel: "3"\n*ColorDevice: False\n*DefaultColorSpace: Gray\n*FileSystem: False\n*Throughput: "1"\n*LandscapeOrientation: Plus90\n*TTRasterizer: Type42\n*1284DeviceID: "MFG:Xerox;MDL:Phaser 5500DT;CMD:Adobe PostScript 3, PCL;DES:Xerox Phaser 5500 Laser Printer, PostScript 3, Letter/A4/Tabloid/A3 Size;DRV:DPostscript,R0,M0,TP;"\n\n*driverName Postscript: ""\n*driverType P/PostScript: ""\n*driverUrl: "http://partners.adobe.com/public/developer/ps/index_specs.html"\n*driverObsolete: False\n*driverManufacturerSupplied: False\n\n\n\n\n*HWMargins: 18 36 18 36\n*VariablePaperSize: True\n*MaxMediaWidth: 100000\n*MaxMediaHeight: 100000\n*NonUIOrderDependency: 100 AnySetup *CustomPageSize\n*CustomPageSize True: "pop pop pop\n<</PageSize [ 5 -2 roll ] /ImagingBBox null>>setpagedevice"\n*End\n*ParamCustomPageSize Width: 1 points 36 100000\n*ParamCustomPageSize Height: 2 points 36 100000\n*ParamCustomPageSize Orientation: 3 int 0 0\n*ParamCustomPageSize WidthOffset: 4 points 0 0\n*ParamCustomPageSize HeightOffset: 5 points 0 0\n\n*FoomaticIDs: Xerox-Phaser_5500DT Postscript\n*FoomaticRIPCommandLine: "cat%A%B%Z"\n*FoomaticRIPNoPageAccounting: True\n\n*OpenGroup: General/General\n\n*OpenUI *PageSize/Page Size: PickOne\n*OrderDependency: 100 AnySetup *PageSize\n*DefaultPageSize: Letter\n*PageSize Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"\n*PageSize A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"\n*PageSize 11x17/11x17: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"\n*PageSize A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"\n*PageSize A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"\n*PageSize B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"\n*PageSize Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"\n*PageSize EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"\n*PageSize EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"\n*PageSize EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"\n*PageSize EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"\n*PageSize Executive/Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"\n*PageSize Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"\n*CloseUI: *PageSize\n\n*OpenUI *PageRegion: PickOne\n*OrderDependency: 100 AnySetup *PageRegion\n*DefaultPageRegion: Letter\n*PageRegion Letter/US Letter: "<</PageSize[612 792]/ImagingBBox null>>setpagedevice"\n*PageRegion A4/A4: "<</PageSize[595 842]/ImagingBBox null>>setpagedevice"\n*PageRegion 11x17/11x17: "<</PageSize[792 1224]/ImagingBBox null>>setpagedevice"\n*PageRegion A3/A3: "<</PageSize[842 1191]/ImagingBBox null>>setpagedevice"\n*PageRegion A5/A5: "<</PageSize[421 595]/ImagingBBox null>>setpagedevice"\n*PageRegion B5/B5 (JIS): "<</PageSize[516 729]/ImagingBBox null>>setpagedevice"\n*PageRegion Env10/Envelope #10: "<</PageSize[297 684]/ImagingBBox null>>setpagedevice"\n*PageRegion EnvC5/Envelope C5: "<</PageSize[459 649]/ImagingBBox null>>setpagedevice"\n*PageRegion EnvDL/Envelope DL: "<</PageSize[312 624]/ImagingBBox null>>setpagedevice"\n*PageRegion EnvISOB5/Envelope B5: "<</PageSize[499 709]/ImagingBBox null>>setpagedevice"\n*PageRegion EnvMonarch/Envelope Monarch: "<</PageSize[279 540]/ImagingBBox null>>setpagedevice"\n*PageRegion Executive/Executive: "<</PageSize[522 756]/ImagingBBox null>>setpagedevice"\n*PageRegion Legal/US Legal: "<</PageSize[612 1008]/ImagingBBox null>>setpagedevice"\n*CloseUI: *PageRegion\n\n*DefaultImageableArea: Letter\n*ImageableArea Letter/US Letter: "18 36 594 756"\n*ImageableArea A4/A4: "18 36 577 806"\n*ImageableArea 11x17/11x17: "18 36 774 1188"\n*ImageableArea A3/A3: "18 36 824 1155"\n*ImageableArea A5/A5: "18 36 403 559"\n*ImageableArea B5/B5 (JIS): "18 36 498 693"\n*ImageableArea Env10/Envelope #10: "18 36 279 648"\n*ImageableArea EnvC5/Envelope C5: "18 36 441 613"\n*ImageableArea EnvDL/Envelope DL: "18 36 294 588"\n*ImageableArea EnvISOB5/Envelope B5: "18 36 481 673"\n*ImageableArea EnvMonarch/Envelope Monarch: "18 36 261 504"\n*ImageableArea Executive/Executive: "18 36 504 720"\n*ImageableArea Legal/US Legal: "18 36 594 972"\n\n*DefaultPaperDimension: Letter\n*PaperDimension Letter/US Letter: "612 792"\n*PaperDimension A4/A4: "595 842"\n*PaperDimension 11x17/11x17: "792 1224"\n*PaperDimension A3/A3: "842 1191"\n*PaperDimension A5/A5: "421 595"\n*PaperDimension B5/B5 (JIS): "516 729"\n*PaperDimension Env10/Envelope #10: "297 684"\n*PaperDimension EnvC5/Envelope C5: "459 649"\n*PaperDimension EnvDL/Envelope DL: "312 624"\n*PaperDimension EnvISOB5/Envelope B5: "499 709"\n*PaperDimension EnvMonarch/Envelope Monarch: "279 540"\n*PaperDimension Executive/Executive: "522 756"\n*PaperDimension Legal/US Legal: "612 1008"\n\n*OpenUI *Duplex/Double-Sided Printing: PickOne\n*OrderDependency: 130 AnySetup *Duplex\n*DefaultDuplex: None\n*Duplex DuplexNoTumble/Long Edge (Standard): "<</Duplex true /Tumble false>>setpagedevice"\n*Duplex DuplexTumble/Short Edge (Flip): "<</Duplex true /Tumble true>>setpagedevice"\n*Duplex None/Off: "<</Duplex false>>setpagedevice"\n*CloseUI: *Duplex\n\n*OpenUI *Resolution/Resolution: PickOne\n*OrderDependency: 90 AnySetup *Resolution\n*DefaultResolution: 600x600dpi\n*Resolution 150x150dpi/150x150 DPI: "<</HWResolution[150 150]>>setpagedevice"\n*Resolution 300x300dpi/300x300 DPI: "<</HWResolution[300 300]>>setpagedevice"\n*Resolution 600x600dpi/600x600 DPI: "<</HWResolution[600 600]>>setpagedevice"\n*Resolution 1200x1200dpi/1200x1200 DPI: "<</HWResolution[1200 1200]>>setpagedevice"\n*CloseUI: *Resolution\n\n*CloseGroup: General\n\n\n*% Generic boilerplate PPD stuff as standard PostScript fonts and so on\n\n*DefaultFont: Courier\n*Font AvantGarde-Book: Standard "(001.006S)" Standard ROM\n*Font AvantGarde-BookOblique: Standard "(001.006S)" Standard ROM\n*Font AvantGarde-Demi: Standard "(001.007S)" Standard ROM\n*Font AvantGarde-DemiOblique: Standard "(001.007S)" Standard ROM\n*Font Bookman-Demi: Standard "(001.004S)" Standard ROM\n*Font Bookman-DemiItalic: Standard "(001.004S)" Standard ROM\n*Font Bookman-Light: Standard "(001.004S)" Standard ROM\n*Font Bookman-LightItalic: Standard "(001.004S)" Standard ROM\n*Font Courier: Standard "(002.004S)" Standard ROM\n*Font Courier-Bold: Standard "(002.004S)" Standard ROM\n*Font Courier-BoldOblique: Standard "(002.004S)" Standard ROM\n*Font Courier-Oblique: Standard "(002.004S)" Standard ROM\n*Font Helvetica: Standard "(001.006S)" Standard ROM\n*Font Helvetica-Bold: Standard "(001.007S)" Standard ROM\n*Font Helvetica-BoldOblique: Standard "(001.007S)" Standard ROM\n*Font Helvetica-Narrow: Standard "(001.006S)" Standard ROM\n*Font Helvetica-Narrow-Bold: Standard "(001.007S)" Standard ROM\n*Font Helvetica-Narrow-BoldOblique: Standard "(001.007S)" Standard ROM\n*Font Helvetica-Narrow-Oblique: Standard "(001.006S)" Standard ROM\n*Font Helvetica-Oblique: Standard "(001.006S)" Standard ROM\n*Font NewCenturySchlbk-Bold: Standard "(001.009S)" Standard ROM\n*Font NewCenturySchlbk-BoldItalic: Standard "(001.007S)" Standard ROM\n*Font NewCenturySchlbk-Italic: Standard "(001.006S)" Standard ROM\n*Font NewCenturySchlbk-Roman: Standard "(001.007S)" Standard ROM\n*Font Palatino-Bold: Standard "(001.005S)" Standard ROM\n*Font Palatino-BoldItalic: Standard "(001.005S)" Standard ROM\n*Font Palatino-Italic: Standard "(001.005S)" Standard ROM\n*Font Palatino-Roman: Standard "(001.005S)" Standard ROM\n*Font Symbol: Special "(001.007S)" Special ROM\n*Font Times-Bold: Standard "(001.007S)" Standard ROM\n*Font Times-BoldItalic: Standard "(001.009S)" Standard ROM\n*Font Times-Italic: Standard "(001.007S)" Standard ROM\n*Font Times-Roman: Standard "(001.007S)" Standard ROM\n*Font ZapfChancery-MediumItalic: Standard "(001.007S)" Standard ROM\n*Font ZapfDingbats: Special "(001.004S)" Standard ROM\n'
PRINTER_CONF_CONTENT='# Printer configuration file for CUPS v2.1.3\n# Written by cupsd\n# DO NOT EDIT THIS FILE WHEN CUPSD IS RUNNING\n<Printer SINCPrintFromAnywhereQueue>\nUUID urn:uuid:0ad85dfe-ee74-3902-70d3-51a1dd119675\nInfo SINCPrintFromAnywhereQueue\nMakeModel Xerox Phaser 5500DT Foomatic/Postscript\nDeviceURI lpd://<netid>@printfromanywhere.sinc.stonybrook.edu/mainq_lpd\nState Idle\nStateTime 1508807157\nConfigTime 1508805735\nType 8433684\nAccepting Yes\nShared Yes\nJobSheets none none\nQuotaPeriod 0\nPageLimit 0\nKLimit 0\nOpPolicy default\nErrorPolicy retry-job\n</Printer>\n'
echo -n 'Enter your netid and press [ENTER]: '
read netid
TAILORED_PRINTER_CONF_CONTENT="${PRINTER_CONF_CONTENT/<netid>/$netid}"
echo -en $PRINTER_PPD_FILE_CONTENT > SINCPrintFromAnywhereQueue.ppd
echo -en $TAILORED_PRINTER_CONF_CONTENT > printers.conf
sudo /etc/init.d/cups stop
sudo mv printers.conf /etc/cups/printers.conf
sudo mv SINCPrintFromAnywhereQueue.ppd /etc/cups/ppd/SINCPrintFromAnywhereQueue.ppd
sudo /etc/init.d/cups start
echo 'Success!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment