author | sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM> |
Mon, 04 Apr 2011 23:24:05 -0700 | |
changeset 165 | 111c46cade93 |
permissions | -rw-r--r-- |
165
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
1 |
#!/usr/bin/ksh |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
2 |
# |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
4 |
# |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
8 |
# |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
13 |
# |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
19 |
# |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
21 |
# |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
22 |
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
23 |
# |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
24 |
|
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
25 |
PPDSRC=${PPDSRC:-"${VER}/share/ppd"} |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
26 |
|
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
27 |
MODEL="ModelName" |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
28 |
NICK="NickName" |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
29 |
SED="/usr/bin/sed" |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
30 |
|
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
31 |
if [ -f ${CACHE} ]; |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
32 |
then |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
33 |
/bin/rm ${CACHE} |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
34 |
fi |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
35 |
|
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
36 |
# |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
37 |
# build a ppdcache for the hpijs PPD files |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
38 |
# |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
39 |
cd ${PPDSRC} |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
40 |
for i in `/bin/ls` |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
41 |
do |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
42 |
cd $i |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
43 |
for j in `/bin/ls` |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
44 |
do |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
45 |
case "$j" in |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
46 |
*.gz) |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
47 |
SRCFILE=/tmp/ppd.$$ |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
48 |
gzcat $j >${SRCFILE} |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
49 |
PPDFILE="${IPATH}${i}/${j}" |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
50 |
;; |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
51 |
*) |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
52 |
SRCFILE=$j |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
53 |
PPDFILE="${IPATH}${i}/${j}.gz" |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
54 |
;; |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
55 |
esac |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
56 |
|
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
57 |
/usr/bin/grep $SRCFILE ${DONOTINSTALL} > /dev/null |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
58 |
if [ $? = 1 ]; |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
59 |
then |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
60 |
MANU=$i |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
61 |
MODEL=`/usr/bin/grep "*ModelName:" $SRCFILE | /usr/bin/cut -d '"' -f2` |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
62 |
NICKN=`/usr/bin/grep "*NickName:" $SRCFILE | /usr/bin/cut -d '"' -f2` |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
63 |
for k in ${MODEL} |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
64 |
do |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
65 |
# change / to \/ for sed |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
66 |
typeset i_clean=$(echo $k | ${SED} -e 's/\//\\\//g') |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
67 |
NICKN=$(echo $NICKN | ${SED} -e "s/$i_clean//" | ${SED} -e "s/^ //") |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
68 |
done |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
69 |
|
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
70 |
echo ${MANU}:${MODEL}:${NICKN}:::${PPDFILE} >> ${CACHE} |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
71 |
fi |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
72 |
done |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
73 |
cd .. |
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
74 |
|
111c46cade93
7018146 move hplip to userland
sonam gupta - Sun Microsystems - Bangalore India <Sonam.Gupta@Sun.COM>
parents:
diff
changeset
|
75 |
done |