components/foomatic/fppd/supportedonly.sh
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Wed, 29 Aug 2012 11:05:56 -0700
changeset 957 255465c5756f
parent 335 223d5bf98b72
permissions -rw-r--r--
Close of build 04.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
335
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     1
#!/bin/bash
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     2
#
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     3
# CDDL HEADER START
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     4
#
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     8
#
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    12
# and limitations under the License.
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    13
#
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    19
#
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    20
# CDDL HEADER END
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    21
#
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    22
#
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    23
# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    24
#
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    25
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    26
# Find the PPD files delivered by foomatic that Solaris does not support.
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    27
# There are two reasons for non-support:
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    28
#
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    29
#	1. license/patent issues with the driver (listed in file nolicense). These
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    30
#	   files are removed and not delivered
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    31
#	2. The driver used by the PPD file must be brought downand compiled and
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    32
#	   Solaris has not chosen to do so. In that case the PPD file is delivered,
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    33
#	   but not included in the generated cache file.
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    34
#
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    35
# The unsupported PPD file should be listed in $BUILD_DIR/ppdunsupported for
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    36
# review. The catchall file, ppdsnomatch, should be empty. If not, a new
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    37
# case is needed in this script. The other files are there for debugging
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    38
# purposes.
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    39
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    40
# Notes:
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    41
#	drivers come in several flavors: gs built in, gs uniprint, postscript,
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    42
#	hpijs, and then the several other drivers.
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    43
# Drivers are noted in many PPD files with driverType. To sort these, look
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    44
# for:	driverType G/GhostScript built-in:
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    45
#	driverType U/GhostScript Uniprint:
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    46
#	driverType F/Filter: "" 
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    47
# Drivers are also noted in the name of the ppd file. This is used
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    48
# to cull out postscript, hpijs, and pxlmono . These do not reliably
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    49
# use driverType. note: pxlmono driver is a gs built-in but many of the
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    50
# ppd files that use this driver do not utilize the driverType line.
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    51
# driverType I/IJS: "" is not reliable for hpijs as not used in many ppds.
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    52
 
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    53
# driverType F/Filter: "" denotes ppd files that use GhostScript and
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    54
# then pipe that output to one or more other drivers. These will only be 
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    55
# supported if Solaris compiles and delivers these drivers.
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    56
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    57
# Make sure that there are no undefined variables
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    58
set -ue
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    59
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    60
# Sanitize PATH
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    61
PATH=/usr/bin:/bin
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    62
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    63
if [ -z "${1-}" ] || [ -z "${2-}" ] ||
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    64
	[ -z "${3-}" ] || [ -z "${4-}" ]; then
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    65
	echo "Usage: $0 build-dir tree-of-ppds cache-file nolicense-file"
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    66
	exit 1
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    67
fi
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    68
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    69
# Build directory
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    70
BUILD_DIR="$1"
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    71
# Where PPD files are located
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    72
BASE="$2"
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    73
# Cache file to be created
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    74
CACHE="$3"
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    75
# File listing PPDs with no/invalid license
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    76
NOLICENSE="$4"
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    77
# Base install path for PPD files
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    78
IPATH=/usr/share/ppd/SUNWfoomatic
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    79
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    80
# Script will fail if set
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    81
FAIL_LATER=""
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    82
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    83
mkdir -p "$( dirname "$CACHE" )"
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    84
/bin/rm -f ${BUILD_DIR}/ppdunsupported \
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    85
		${BUILD_DIR}/ppdsupported \
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    86
		${BUILD_DIR}/ppdsnomatch \
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    87
		"$CACHE"
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    88
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    89
# files which should be included in the cache
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    90
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    91
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    92
#-----
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    93
##
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    94
## add_to_cache
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    95
##
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    96
## That means the PPD will be included in ## generated cache. Function uses
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    97
## global variables $i and $j. Function expects that we are already in
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    98
## directory $i
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    99
##
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   100
#-----
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   101
add_to_cache() {
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   102
	typeset SRCFILE
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   103
	typeset PPDFILE
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   104
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   105
	# Add the file to the cache
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   106
	case "$j" in
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   107
		*.gz)
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   108
			SRCFILE=${BUILD_DIR}/ppd.$$
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   109
			gzcat $BASE/$i/$j >${SRCFILE}
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   110
			PPDFILE="${IPATH}/$i/$j"
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   111
			;;
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   112
		*)
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   113
			SRCFILE=$BASE/$i/$j
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   114
			PPDFILE="${IPATH}/$i/$j.gz"
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   115
			;;
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   116
	esac
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   117
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   118
	typeset MANU=$i
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   119
	typeset MODEL
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   120
	MODEL=`grep "*ModelName:" $SRCFILE | cut -d '"' -f2`
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   121
	typeset NICKN
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   122
	NICKN=`grep "*NickName:" $SRCFILE | cut -d '"' -f2`
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   123
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   124
	typeset k
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   125
	for k in ${MODEL}
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   126
	do
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   127
		# change / to \/ for sed
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   128
		typeset i_clean=$(echo $k | sed -e 's/\//\\\//g')
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   129
		NICKN=$( echo $NICKN |
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   130
			sed -e "s/$i_clean//" | sed -e "s/^ //" )
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   131
	done
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   132
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   133
	echo ${MANU}:${MODEL}:${NICKN}:::${PPDFILE} >> ${CACHE}
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   134
}
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   135
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   136
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   137
#-----
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   138
##
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   139
## supported
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   140
##
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   141
## process PPD supported file.
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   142
##
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   143
#-----
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   144
supported() {
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   145
	echo "$i/$j" >> ${BUILD_DIR}/ppdsupported
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   146
	add_to_cache
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   147
}
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   148
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   149
#-----
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   150
##
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   151
## unsupported
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   152
##
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   153
## Handle PPD files NOT supported and thus included in the cache
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   154
##
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   155
#-----
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   156
unsupported() {
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   157
	echo "$i/$j - $1" >> ${BUILD_DIR}/ppdunsupported
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   158
}
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   159
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   160
#-----
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   161
##
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   162
## nomatch
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   163
##
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   164
## Handle PPD files for which we don't know how to decide whether it's
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   165
## supported or not
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   166
##
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   167
#-----
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   168
nomatch() {
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   169
	echo "$i/$j" >> ${BUILD_DIR}/ppdsnomatch
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   170
	echo "file '$i/$j' did not match any rule"
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   171
	FAIL_LATER=1
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   172
}
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   173
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   174
# Go to directory with PPD files
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   175
cd "$BASE"
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   176
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   177
# Walk through all the PPD files available
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   178
for i in *
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   179
do
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   180
	cd "$i"
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   181
		for j in *
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   182
		do
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   183
			# First detect all files listed in the "nolicense" file
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   184
			if ls $j | /usr/xpg4/bin/grep -f "$NOLICENSE" >/dev/null ; then
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   185
				echo "Removing file '$j' because it is listed in 'nolicense' file"
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   186
				/bin/rm $j
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   187
				continue
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   188
			fi
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   189
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   190
			# The following cases pull out supported drivers
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   191
			if ls $j | grep Postscript > /dev/null; then
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   192
				supported
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   193
				continue
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   194
			fi
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   195
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   196
			if grep "driverType G/GhostScript built-in: " $j >> /dev/null; then
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   197
				supported
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   198
				continue
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   199
			fi
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   200
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   201
			if grep "driverType U/GhostScript Uniprint: " $j >> /dev/null; then
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   202
				supported
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   203
				continue
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   204
			fi
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   205
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   206
			# HPLIP (hpijs) supplies it's own Foomatic PPD files
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   207
			if ls $j | grep hpijs > /dev/null; then
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   208
				unsupported 'hpijs'
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   209
				continue
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   210
			fi
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   211
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   212
			if ls $j | grep pxlmono > /dev/null; then
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   213
				supported 'pxlmono'
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   214
				continue
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   215
			fi
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   216
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   217
			# These are the unsupported printers unless
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   218
			# we build and deliver the drivers
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   219
			if grep "driverType F/Filter: """ $j >> /dev/null; then
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   220
				unsupported 'driverType F/Filter'
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   221
				continue
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   222
			fi
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   223
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   224
			# No match : this should not happen
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   225
			nomatch
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   226
		done
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   227
	cd ..
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   228
done
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   229
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   230
if [ -n "$FAIL_LATER" ]; then
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   231
	exit 1
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   232
else
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   233
	exit 0
223d5bf98b72 7049357 Move foomatic-* stuff to Userland.
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   234
fi