10Sstevel@tonic-gate#!/usr/bin/ksh 20Sstevel@tonic-gate# 30Sstevel@tonic-gate# CDDL HEADER START 40Sstevel@tonic-gate# 50Sstevel@tonic-gate# The contents of this file are subject to the terms of the 60Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only 70Sstevel@tonic-gate# (the "License"). You may not use this file except in compliance 80Sstevel@tonic-gate# with the License. 90Sstevel@tonic-gate# 100Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 110Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 120Sstevel@tonic-gate# See the License for the specific language governing permissions 130Sstevel@tonic-gate# and limitations under the License. 140Sstevel@tonic-gate# 150Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 160Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 170Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 180Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 190Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 200Sstevel@tonic-gate# 210Sstevel@tonic-gate# CDDL HEADER END 220Sstevel@tonic-gate# 230Sstevel@tonic-gate# 240Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 250Sstevel@tonic-gate# 26*1211Swendyp# Copyright 2006 Sun Microsystems, Inc. All rights reserved. 270Sstevel@tonic-gate# Use is subject to license terms. 280Sstevel@tonic-gate# 290Sstevel@tonic-gate 300Sstevel@tonic-gate# 310Sstevel@tonic-gate# Get the make/model/nickname from ppdfilename 320Sstevel@tonic-gate# 330Sstevel@tonic-gate 340Sstevel@tonic-gateif [[ $# -lt 1 ]]; then 350Sstevel@tonic-gate exit 1 360Sstevel@tonic-gatefi 370Sstevel@tonic-gate 380Sstevel@tonic-gateif [[ -f /usr/lib/lp/model/ppd/ppdcache ]]; then 390Sstevel@tonic-gate 400Sstevel@tonic-gate ppdfile=`/bin/grep $1 /usr/lib/lp/model/ppd/ppdcache` 410Sstevel@tonic-gate 420Sstevel@tonic-gate if [[ -z "$ppdfile" ]]; then 430Sstevel@tonic-gate 440Sstevel@tonic-gate # Perhaps this is an old configuration file 450Sstevel@tonic-gate # look for ppd file in new directories 460Sstevel@tonic-gate 470Sstevel@tonic-gate # Get last two fields from arg1: full path/filename of ppd 480Sstevel@tonic-gate # file. Separate with /. 490Sstevel@tonic-gate # arg1: /usr/lib/lp/model/ppd/<MANU>/<filename> 500Sstevel@tonic-gate 510Sstevel@tonic-gate manufile=`echo $1 | /bin/nawk -F/ '{ print $7 "/" $8 }` 520Sstevel@tonic-gate 530Sstevel@tonic-gate # search for ppd file in all the directories under system 540Sstevel@tonic-gate # Use the first one found 550Sstevel@tonic-gate 560Sstevel@tonic-gate for dir in /usr/lib/lp/model/ppd/system/*; do 570Sstevel@tonic-gate if [[ -d "$dir" ]]; then 580Sstevel@tonic-gate target=$dir/$manufile 590Sstevel@tonic-gate found=`/bin/grep $target /usr/lib/lp/model/ppd/ppdcache` 600Sstevel@tonic-gate 610Sstevel@tonic-gate if [[ -z "$ppdfile" && -n "$found" ]]; then 620Sstevel@tonic-gate ppdfile=$found 630Sstevel@tonic-gate fi 640Sstevel@tonic-gate 650Sstevel@tonic-gate 660Sstevel@tonic-gate fi 670Sstevel@tonic-gate done 680Sstevel@tonic-gate 690Sstevel@tonic-gate fi 700Sstevel@tonic-gate 710Sstevel@tonic-gate if [[ -z "$ppdfile" ]]; then 720Sstevel@tonic-gate exit 1 730Sstevel@tonic-gate else 74*1211Swendyp # Use only first word in manufacturer entry 750Sstevel@tonic-gate echo $ppdfile | 76*1211Swendyp nawk '{FS=":"; print $1}' | 77*1211Swendyp nawk '{print $1}' 78*1211Swendyp 79*1211Swendyp echo $ppdfile | 80*1211Swendyp nawk '{FS=":"; print $2; print $3}' 810Sstevel@tonic-gate exit 0 820Sstevel@tonic-gate fi 830Sstevel@tonic-gatefi 84