Select Page

Definitions

  • CAPS is the enterprise printing system that is primarily used by students across the University network.
  • CUPS or Common Unix Printing System, is the print engine in MacOS X that is also included in linux builds, and other Unix platforms. The engine uses printer description files to connect consistent interfaces in the printing system to the more quirky world of printer hardware.
  • Generic means not tied to any particular configuration or feature set. Universal would be a suitable alternative to this term.

Theory

  • A large amount of a normal users printing requirements can be fulfilled using very few printer features.
    The printer description provided here supports any permutation of A4, A3, simplex/duplex, n-up (multiple pages per side), scaling, colour (CMYK/RGB/greyscale), and resolution (300/600/1200dpi).
  • A large number of common printer problems can be resolved by being less specific about the capabilities of a printer.
    The printer description provided here makes no assumptions about tray assignment, input, output and process options, and uses basic postscript capabilities.
  • A large number of common printer problems can be resolved by simplifying the feature set exposed to users.
    The printer description provided here presents some sensible defaults in the easy to reach UI elements of the driver, but allows access to the more detailed controls it inherits from the RICOH parent used as the base.
  • Generic printers do not preclude more tailored options, but provide a ubiquitous substrate.

Practice

A bash script that installs some basic printer descriptions, enables the appropriate interfaces in the local CUPS subsystem (we assume there is one in place), then creates two generic queues that should allow a normal user logged on with their UPI to print to the CAPS system and get predictable results.

You have to be able to sudo, and the system you are running this on needs to be running CUPS. The script has been tested on lots of versions of MacOS X (10.6-10.9), and a few versions of Unbuntu, Centos and Fedora.

It should work from anywhere on the internet, but is really only relevant for people coming to the University campus. HOWEVER, there is nothing stopping you use this same generic driver for other print services.

The script

#!/bin/bash

LIBRARY=/Library
MANAGEMENT=$LIBRARY/Management
PPDHOME=$MANAGEMENT/ppd
IAM=`whoami`
WHICH=`uname`
if [[ $WHICH == "Darwin" ]]; then

	#	MacOS X (probably)
	WGETCURL=curl -o
	WGETSHORT=curl -o -
else
	#	Probably linux
	WGETCURL=wget -O
	WGETSHORT=wget -q -O -
fi

if [ "$IAM" = "root" ]; then

	#	bwa ha ha
 	#	check for existing directories
	#	and create any missing ones

	#	Ubuntu 12.x needed this check
	if [ ! -e /etc/cups/interfaces ]; then

		mkdir /etc/cups/interfaces
		chmod 755 /etc/cups/interfaces
	fi

	#	Check for and fill out
	#	SIT management folders
	if [ ! -e $LIBRARY ]; then
		mkdir $LIBRARY
		chmod -R 775 $LIBRARY
	fi
	if [ ! -e $MANAGEMENT ]; then
			mkdir $MANAGEMENT
			chmod -R 775 $MANAGEMENT
	fi
	if [ ! -e $PPDHOME ]; then
			mkdir $PPDHOME
			chmod -R 775 $PPDHOME
	fi

	#	grab a copy of the PS PPD
	#	and the generic variant
	#	from our WWW server

	#	Ubuntu has wget, MacOS X has curl
	$WGETCURL $PPDHOME/ricuoaps.ppd https://www.sit.auckland.ac.nz/delivery/valuables/foscolourlaser/ppd/300/ricuoaps.ppd
	$WGETCURL $PPDHOME/ricbw2up.ppd https://www.sit.auckland.ac.nz/delivery/valuables/foscolourlaser/ppd/300/ricbw2up.ppd

	#	People need access
	chmod 644 $PPDHOME/*.ppd

 	#	which of the many spoolers should be used?
 	SPOOLER=`$WGETSHORT https://www.sit.auckland.ac.nz/sso/tools/spooler/`
 	if [ "$SPOOLER" = "" ];
 	then
 		SPOOLER=uoaprnp01
 	fi

	#	build the printers
	lpadmin -p caps-colour -E -L Everywhere -D CAPS Colour/simplex -P $PPDHOME/ricuoaps.ppd -v lpd://$SPOOLER.uoa.auckland.ac.nz/lp
	lpadmin -p caps-bandw -E -L Everywhere -D CAPS Grey/duplex -P $PPDHOME/ricbw2up.ppd -v lpd://$SPOOLER.uoa.auckland.ac.nz/lp

else
 	#	duh
 	echo "you need to run this as root, try sudo $0"
	exit 1
fi

exit 0

er, what do I do with this?

Select everything from the #!/bin/bash through to the exit 0 . COPY

Open up a terminal on the machine you want to use this on, and create a new text file by typing something like

$ nano installprinters.sh

This will create a file called installprinters.sh and present you with an editing interface

PASTE -should put a copy of the stuff in your clipboard into the file. Check that line breaks have not been placed in odd parts of the script.

Save and exit (in nano: CTRL+o, enter, CTRL+x).

Make the file executable,

$ chmod 700 installprinters.sh

Then run it as the super user

sudo ./installprinters.sh

DONE!

 

My username is not my UPI

The script above assumes the local user doing the printing is logged on using a name the CAPS system recognises. By default the owner associated with the job is the username of the person doing the printing. In may cases, this username may not be recognised by CAPS. It is possible to set up queues for specific users using a variation of the lpadmin command used in the script.

Assuming you have run the script above, use something like the following to configure a user specific queue (this is a single command line, <CRLF -press ‘enter’>, allows you to break it up in the console, and makes it easier to read here.

$ sudo lpadmin 
-p caps-myupi 
-E 
-L Everywhere
-D CAPS for myupi 
-P /Library/Management/ppd/ricuoaps.ppd
-v lpd://myupi@uoaprnp01.uoa.auckland.ac.nz/lp

myupi should be replaced with the username used by CAPS (normally a UPI), and the paths and choice of spooler should be adjusted to accommodate the specific context. This command will create a printer called caps-myupi that the user will see as CAPS for myupi. The myupi@uoaprn… part is what puts the UPI into the print job as the owner. Potentially, you can use this to spool jobs for any user -though this is only useful to the users themselves.

What about the popup client?

If you have installed the CAPS popup based driver for wireless users, then (if you still want to use this generic printer description), modify the lpd://[user@]spooler.address/queue to popup://[user@]spooler.address/queue

The Pharos popup client allows you to modify the job owner (and, for certain printers,  select an account to pay for the job). The popup part is independent of the print driver (though they are bundled in the UoA distribution).

Windows

While CUPS can be installed in Windows, it is not part of the operating system as it is in LINUX and MacOS X. The printer description provided will work with the Windows CUPS software.

I looked into creating a GDI/XPP variant for Windows, which has something like the postscript printer description at its heart, but the red tape around developing such a thing (signing requirements, the overhead of VisualStudio, etc) made it an unattractive prospect. Compiling a nice package for CUPS installation in Windows would have been a better investment.

 

 

 

Skip to toolbar