usr/src/cmd/foomatic-ppd/findunsupported.sh
author Jon Tibble <meths@btinternet.com>
Mon, 04 May 2015 14:04:39 +0100
branchoi_151a
changeset 254 9c2a4ac793f0
parent 0 b34509ac961f
permissions -rwxr-xr-x
Bash patch catchup including shellshock

#!/usr/bin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
#ident	"@(#)findunsupported.sh	1.2	08/09/23 SMI"



# Find the PPD files delivered by foomatic that Sun does not support.
# There are two reasons for non-support:
#
#	1. license/patent issues with the driver: foo2zjs
#	2. The driver used by the PPD file must be brought down
#	and compiled and Sun has not chosen to do so.
#
# The unsupported PPD file should be listed in /tmp/ppdunsupported for review.
# The catchall file, /tmp/ppdsnomatch, should be empty. If not, a new case
# is needed in this script. The other files are there for debugging purposes.
#
# This is not part of the build process as the resulting file, ppdunsupported,
# should be reviewed.

# Notes:
#	drivers come in several flavors: gs built in, gs uniprint, postscript,
#	hpijs, and then the several other drivers.
# Drivers are noted in many PPD files with driverType. To sort these, look
# for:	driverType G/GhostScript built-in:
#	driverType U/GhostScript Uniprint:
#	driverType F/Filter: "" 
# Drivers are also noted in the name of the ppd file. This is used
# to cull out postscript, hpijs, and pxlmono . These do not reliably
# use driverType. note: pxlmono driver is a gs built-in but many of the
# ppd files that use this driver do not utilize the driverType line.
# driverType I/IJS: "" is not reliable for hpijs as not used in many ppds.
 
# driverType F/Filter: "" denotes ppd files that use GhostScript and
# then pipe that output to one or more other drivers. These will only be 
# supported if Sun compiles and delivers these drivers.

VER=foomatic-filters-ppds-20080818

if [ -f  ${SRC}/cmd/foomatic-ppd/ppdunsupported ]; then 
	/bin/rm ${SRC}/cmd/foomatic-ppd/ppdunsupported
fi
if [ -f  ${SRC}/cmd/foomatic-ppd/ppdsnomatch ]; then
	/bin/rm ${SRC}/cmd/foomatic-ppd/ppdsnomatch 
fi
if [ -f  ${SRC}/cmd/foomatic-ppd/ppdsupported ]; then 
	/bin/rm ${SRC}/cmd/foomatic-ppd/ppdsupported
fi

cd $VER/share/ppd

for i in *
do
	cd $i
		for j in *
		do
			# The following cases pull out supported drivers
			ls $j | grep Postscript > /dev/null
			if [ $? = 0 ]; then
				#echo $j >> /tmp/ppdps
				echo $j >> ${SRC}/cmd/foomatic-ppd/ppdsupported
				continue
			fi

			grep "driverType G/GhostScript built-in: """ $j >> /dev/null
			if [ $? = 0 ];
			then
				#echo $j >> /tmp/ppdsgsbuiltin
				echo $j >> ${SRC}/cmd/foomatic-ppd/ppdsupported
				continue
			fi

			grep "driverType U/GhostScript Uniprint: """ $j >> /dev/null
			if [ $? = 0 ];
			then
				#echo $j >> /tmp/ppdgsuniprint
				echo $j >> ${SRC}/cmd/foomatic-ppd/ppdsupported
				continue
			fi

			ls $j | grep hpijs > /dev/null
			if [ $? = 0 ];
			then
				#echo $j >> /tmp/ppdijs
				# HPLIP (hpijs) supplies it's own Foomatic PPD files
				echo $j >> ${SRC}/cmd/foomatic-ppd/ppdunsupported
				continue
			fi

			ls $j | grep pxlmono > /dev/null
			if [ $? = 0 ];
			then
				#echo $j >> /tmp/pxlmono
				echo $j >> ${SRC}/cmd/foomatic-ppd/ppdsupported
				continue
			fi

			# These are the unsupported printers unless
			# we build and deliver the drivers
			grep "driverType F/Filter: """ $j >> /dev/null
			if [ $? = 0 ];
			then
				echo $j >> ${SRC}/cmd/foomatic-ppd/ppdunsupported
				continue
			fi

			# No match : this should be empty
			echo $j >> ${SRC}/cmd/foomatic-ppd/ppdunsupported/ppdsnomatch
		done
	cd ..
done

cd ../../..