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]
22 # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
23 # Use is subject to license terms.
25 # ident "%Z%%M% %I% %E% SMI"
29 # Get the make/model/nickname as well as the repository/label from ppdfilename
34 # /var/lp/ppd/user/HP/foo.ppd.gz
38 # label(repository letter): driver
41 # IBM Page Printer 3112
42 # foomatic(L): Foomatic/hpijs
45 if [[ $# -lt 1 ]]; then
49 cachefile
=/var
/lp
/ppd
/ppdcache
50 [[ -f $cachefile ]] ||
exit 1
52 cacheentry
=$
(/bin
/grep "$1" $cachefile)
53 [[ -n "$cacheentry" ]] ||
exit 1
56 # Retrieve the manufacturer (make)
57 # Use only the first word in manufacturer entry
59 manuf
=$
(echo "$cacheentry" |
60 nawk
'{FS=":"; print $1}' |
64 model
=$
(echo "$cacheentry" | nawk
'{FS=":"; print $2}')
67 driver
=$
(echo "$cacheentry" | nawk
'{FS=":"; print $3}')
70 # Retrieve the PPD path. Parse the PPD path to get the
71 # label path and to figure out the repository letter
72 # associated with the label path. Note:
73 # the PPD file name is the 6th colon separated entry
74 # in the cache entry. This is may need to be modified if the
77 ppdpath
=$
(echo "$cacheentry" |
/bin
/nawk
'{FS=":"; print $6}' )
78 manupath
=$
(/bin
/dirname "$ppdpath")
79 labelpath
=$
(/bin
/dirname "$manupath")
88 /usr
/local
/share
/ppd
/*)
96 [[ -n "${repltr}" ]] ||
exit 1
97 echo "${manuf}\n${model}"
98 echo "$(/bin/basename "$labelpath")(${repltr}): $driver"