5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
26 # Find the PPD files delivered by foomatic that Solaris does not support.
27 # There are two reasons for non-support:
29 # 1. license/patent issues with the driver (listed in file nolicense). These
30 # files are removed and not delivered
31 # 2. The driver used by the PPD file must be brought downand compiled and
32 # Solaris has not chosen to do so. In that case the PPD file is delivered,
33 # but not included in the generated cache file.
35 # The unsupported PPD file should be listed in $BUILD_DIR/ppdunsupported for
36 # review. The catchall file, ppdsnomatch, should be empty. If not, a new
37 # case is needed in this script. The other files are there for debugging
41 # drivers come in several flavors: gs built in, gs uniprint, postscript,
42 # hpijs, and then the several other drivers.
43 # Drivers are noted in many PPD files with driverType. To sort these, look
44 # for: driverType G/GhostScript built-in:
45 # driverType U/GhostScript Uniprint:
46 # driverType F/Filter: ""
47 # Drivers are also noted in the name of the ppd file. This is used
48 # to cull out postscript, hpijs, and pxlmono . These do not reliably
49 # use driverType. note: pxlmono driver is a gs built-in but many of the
50 # ppd files that use this driver do not utilize the driverType line.
51 # driverType I/IJS: "" is not reliable for hpijs as not used in many ppds.
53 # driverType F/Filter: "" denotes ppd files that use GhostScript and
54 # then pipe that output to one or more other drivers. These will only be
55 # supported if Solaris compiles and delivers these drivers.
57 # Make sure that there are no undefined variables
63 if [ -z "${1-}" ] ||
[ -z "${2-}" ] ||
64 [ -z "${3-}" ] ||
[ -z "${4-}" ]; then
65 echo "Usage: $0 build-dir tree-of-ppds cache-file nolicense-file"
71 # Where PPD files are located
73 # Cache file to be created
75 # File listing PPDs with no/invalid license
77 # Base install path for PPD files
78 IPATH
=/usr
/share
/ppd
/SUNWfoomatic
80 # Script will fail if set
83 mkdir
-p "$( dirname "$CACHE" )"
84 /bin
/rm -f ${BUILD_DIR}/ppdunsupported \
85 ${BUILD_DIR}/ppdsupported \
86 ${BUILD_DIR}/ppdsnomatch \
89 # files which should be included in the cache
96 ## That means the PPD will be included in ## generated cache. Function uses
97 ## global variables $i and $j. Function expects that we are already in
105 # Add the file to the cache
108 SRCFILE
=${BUILD_DIR}/ppd.$$
109 gzcat
$BASE/$i/$j >${SRCFILE}
110 PPDFILE
="${IPATH}/$i/$j"
114 PPDFILE
="${IPATH}/$i/$j.gz"
120 MODEL
=`grep "*ModelName:" $SRCFILE | cut -d '"' -f2`
122 NICKN
=`grep "*NickName:" $SRCFILE | cut -d '"' -f2`
127 # change / to \/ for sed
128 typeset i_clean
=$
(echo $k |
sed -e 's/\//\\\//g')
129 NICKN
=$
( echo $NICKN |
130 sed -e "s/$i_clean//" |
sed -e "s/^ //" )
133 echo ${MANU}:${MODEL}:${NICKN}:::${PPDFILE} >> ${CACHE}
141 ## process PPD supported file.
145 echo "$i/$j" >> ${BUILD_DIR}/ppdsupported
153 ## Handle PPD files NOT supported and thus included in the cache
157 echo "$i/$j - $1" >> ${BUILD_DIR}/ppdunsupported
164 ## Handle PPD files for which we don't know how to decide whether it's
169 echo "$i/$j" >> ${BUILD_DIR}/ppdsnomatch
170 echo "file '$i/$j' did not match any rule"
174 # Go to directory with PPD files
177 # Walk through all the PPD files available
183 # First detect all files listed in the "nolicense" file
184 if ls $j |
/usr
/xpg
4/bin
/grep -f "$NOLICENSE" >/dev
/null
; then
185 echo "Removing file '$j' because it is listed in 'nolicense' file"
190 # The following cases pull out supported drivers
191 if ls $j |
grep Postscript
> /dev
/null
; then
196 if grep "driverType G/GhostScript built-in: " $j >> /dev
/null
; then
201 if grep "driverType U/GhostScript Uniprint: " $j >> /dev
/null
; then
206 # HPLIP (hpijs) supplies it's own Foomatic PPD files
207 if ls $j |
grep hpijs
> /dev
/null
; then
212 if ls $j |
grep pxlmono
> /dev
/null
; then
217 # These are the unsupported printers unless
218 # we build and deliver the drivers
219 if grep "driverType F/Filter: """ $j >> /dev
/null
; then
220 unsupported
'driverType F/Filter'
224 # No match : this should not happen
230 if [ -n "$FAIL_LATER" ]; then