0
|
1 |
#!/usr/bin/ksh
|
|
2 |
#
|
|
3 |
# CDDL HEADER START
|
|
4 |
#
|
|
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.
|
|
8 |
#
|
|
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.
|
|
13 |
#
|
|
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]
|
|
19 |
#
|
|
20 |
# CDDL HEADER END
|
|
21 |
#
|
|
22 |
#
|
|
23 |
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
|
|
24 |
# Use is subject to license terms.
|
|
25 |
#
|
|
26 |
#ident "@(#)cache.ksh 1.2 08/09/23 SMI"
|
|
27 |
|
|
28 |
VER=${VER:-"foomatic-filters-ppds-20080818"}
|
|
29 |
PPDSRC=${PPDSRC:-"${VER}/share/ppd"}
|
|
30 |
DONOTINSTALL=${DONOTINSTALL:-"${SRC}/cmd/foomatic-ppd/ppdunsupported"}
|
|
31 |
CACHE=${CACHE:-"${SRC}/cmd/foomatic-ppd/SUNWfoomatic.cache"}
|
|
32 |
IPATH=${IPATH:-"/usr/share/ppd/SUNWfoomatic/"}
|
|
33 |
|
|
34 |
MODEL="ModelName"
|
|
35 |
NICK="NickName"
|
|
36 |
SED="/usr/bin/sed"
|
|
37 |
|
|
38 |
if [ -f ${CACHE} ];
|
|
39 |
then
|
|
40 |
/bin/rm ${CACHE}
|
|
41 |
fi
|
|
42 |
|
|
43 |
#
|
|
44 |
# build a ppdcache for the foomatic PPD files
|
|
45 |
#
|
|
46 |
cd ${PPDSRC}
|
|
47 |
for i in `/bin/ls`
|
|
48 |
do
|
|
49 |
cd $i
|
|
50 |
for j in `/bin/ls`
|
|
51 |
do
|
|
52 |
case "$j" in
|
|
53 |
*.gz)
|
|
54 |
SRCFILE=/tmp/ppd.$$
|
|
55 |
gzcat $j >${SRCFILE}
|
|
56 |
PPDFILE="${IPATH}${i}/${j}"
|
|
57 |
;;
|
|
58 |
*)
|
|
59 |
SRCFILE=$j
|
|
60 |
PPDFILE="${IPATH}${i}/${j}.gz"
|
|
61 |
;;
|
|
62 |
esac
|
|
63 |
|
|
64 |
/usr/bin/grep $SRCFILE ${DONOTINSTALL} > /dev/null
|
|
65 |
if [ $? = 1 ];
|
|
66 |
then
|
|
67 |
MANU=$i
|
|
68 |
MODEL=`/usr/bin/grep "*ModelName:" $SRCFILE | /usr/bin/cut -d '"' -f2`
|
|
69 |
NICKN=`/usr/bin/grep "*NickName:" $SRCFILE | /usr/bin/cut -d '"' -f2`
|
|
70 |
for k in ${MODEL}
|
|
71 |
do
|
|
72 |
# change / to \/ for sed
|
|
73 |
typeset i_clean=$(echo $k | ${SED} -e 's/\//\\\//g')
|
|
74 |
NICKN=$(echo $NICKN | ${SED} -e "s/$i_clean//" | ${SED} -e "s/^ //")
|
|
75 |
done
|
|
76 |
|
|
77 |
echo ${MANU}:${MODEL}:${NICKN}:::${PPDFILE} >> ${CACHE}
|
|
78 |
fi
|
|
79 |
done
|
|
80 |
cd ..
|
|
81 |
|
|
82 |
done
|
|
83 |
|
|
84 |
|
|
85 |
|