Skip to toolbar
Select Page

The script below will install a CAPS printer for people who are not logging in to the Linux and OSX computers with their UPI. It is often useful for visitors to the university who have their laptops with accounts not using their UPI as the login to their computer even though they may have a UPI provided by the university. The script requires root access to run so will not be useable if the user does not have admin rights.  Originally written by Mat Carr.

To implement the script just copy and paste the provided script into a suitably named file such as “” . In this example the nano editor is used in a terminal window to create a file, copy the script contents into the file then change the file to being executable and finally run.

nano              #  This command in a terminal starts the nano editor and creates a file

#Copy in contents of the script below into the

chmod +x      # This command in the terminal and same directory as makes the file you have pasted the script into executable, otherwise you cannot run the file.

sudo ./           #  This command in the terminal and same directory as runs the script contained in the file and installs the printer. 

The shell script below (e.g. place in an executable file such as should be run as root in bash (ie. $ sudo path/to/

The script has been tested in OS X 10.8, 10.9 and Ubuntu 12.04LTS.

The Ubuntu environment does not understand the default duplex setting, but double siding is certainly a user accessible option through the printing interface.


echo $WHICH
if [[ $WHICH == "Darwin" ]]; then
	#	MacOS X (probably)
	WGETCURL=curl -o
	WGETSHORT=curl -o -
	#	Probably linux
	WGETSHORT=wget -q -O -
if [ "$IAM" = "root" ]; then
	#	bwa ha ha
	#	check for existing directores
	#	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
	#	Check for and fill out
	#	SIT management folders
	if [ ! -e $LIBRARY ]; then
		mkdir $LIBRARY
		chmod -R 775 $LIBRARY
	if [ ! -e $MANAGEMENT ]; then
			mkdir $MANAGEMENT
			chmod -R 775 $MANAGEMENT
	if [ ! -e $PPDHOME ]; then
			mkdir $PPDHOME
			chmod -R 775 $PPDHOME
	#	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
	$WGETCURL $PPDHOME/ricbw2up.ppd
	#	People need access
	chmod 644 $PPDHOME/*.ppd
 	#	which of the many spoolers should be used?
 	if [ "$SPOOLER" = "" ];
	#	build the printers
	lpadmin -p caps-colour -E -L Everywhere -D CAPS Colour/simplex -P $PPDHOME/ricuoaps.ppd -v lpd://$
	lpadmin -p caps-bandw -E -L Everywhere -D CAPS Grey/duplex -P $PPDHOME/ricbw2up.ppd -v lpd://$
 	#	duh
 	echo "you need to run this as root, try sudo $0"
	exit 1
exit 0