Home | History | Annotate | Download | only in common_files
      1 #!/bin/sh
      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, Version 1.0 only
      7 # (the "License").  You may not use this file except in compliance
      8 # with the License.
      9 #
     10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     11 # or http://www.opensolaris.org/os/licensing.
     12 # See the License for the specific language governing permissions
     13 # and limitations under the License.
     14 #
     15 # When distributing Covered Code, include this CDDL HEADER in each
     16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     17 # If applicable, add the following below this CDDL HEADER, with the
     18 # fields enclosed by brackets "[]" replaced with your own identifying
     19 # information: Portions Copyright [yyyy] [name of copyright owner]
     20 #
     21 # CDDL HEADER END
     22 #
     23 #
     24 #ident	"%Z%%M%	%I%	%E% SMI"
     25 #
     26 # Copyright (c) 1997 by Sun Microsystems, Inc.
     27 # All rights reserved.
     28 #
     29 
     30 #
     31 # $new is the new version of the file in the package. Unused.
     32 # $old is the old version of the OWconfig file. We rewrite this.
     33 #
     34 # We need to rewrite the following:
     35 #     directory names for PMI files that moved.
     36 #     Three different cases (x2 - one for vga? and one for 8514)
     37 #     where SUNW was placed in front of identifier - vga4, vga8, 8514
     38 #
     39 
     40 if [ -h /etc/openwin/server/etc/OWconfig -a -f /tmp/root/etc/openwin/server/etc/OWconfig ]
     41 then
     42 	cp /tmp/root/etc/openwin/server/etc/OWconfig $PKG_INSTALL_ROOT/etc/openwin/server/etc/OWconfig
     43 else
     44 cat > /tmp/lookup_table <<EOT
     45 gxe_43.pmi SUNWs3 number9/gxe-2.xqa mfreq/mfreq38.vda 8 ddxSUNWs3.so.1 SUNWs3Init
     46 gxe_60.pmi SUNWs3 number9/gxe-2.xqa mfreq/mfreq48.vda 8 ddxSUNWs3.so.1 SUNWs3Init
     47 gxe_70.pmi SUNWs3 number9/gxe-2.xqa mfreq/mfreq56.vda 8 ddxSUNWs3.so.1 SUNWs3Init
     48 mach32_60.pmi SUNWati ati/ultrapro2.xqa mfreq/mfreq64.vda 8 ddxSUNWati.so.1 SUNWatiInit
     49 mach32_70.pmi SUNWati ati/ultrapro2.xqa mfreq/mfreq64.vda 8 ddxSUNWati.so.1 SUNWatiInit
     50 mach32_72.pmi SUNWati ati/ultrapro2.xqa mfreq/mfreq64.vda 8 ddxSUNWati.so.1 SUNWatiInit
     51 mach32_76.pmi SUNWati ati/ultrapro2.xqa mfreq/mfreq80.vda 8 ddxSUNWati.so.1 SUNWatiInit
     52 mach32_87.pmi SUNWati ati/ultrapro2.xqa mfreq/mfreq85.vda 8 ddxSUNWati.so.1 SUNWatiInit
     53 mach32_95.pmi SUNWati ati/ultrapro2.xqa mfreq/mfreq85.vda 8 ddxSUNWati.so.1 SUNWatiInit
     54 EOT
     55 
     56 TMP_FILE=/tmp/`basename $0`.$$
     57 trap 'rm -f $TMP_FILE /tmp/lookup_table' 0 1 2 3 15
     58 
     59 while read new old
     60 do
     61 
     62 #
     63 # If there is no existing file, don't do any of this stuff.
     64 # in that case, $old will be /dev/null
     65 #
     66 	if [ -f $old ]; then
     67 		echo "Converting old OWconfig file to new format."
     68 		cat $old |\
     69 		   /usr/bin/sed -e 's?vesa/vga?devdata/svpmi/SUNWvga?' \
     70                         -e 's?vesa/8514?devdata/svpmi/SUNW8514?' \
     71 		                -e 's?name=\"vga?name=\"SUNWvga?' \
     72 		                -e 's?name=\"8514?name=\"SUNW8514?' \
     73 		                -e 's?listOfScreens=\"vga?listOfScreens=\"SUNWvga?' \
     74 		                -e 's?device=\"vga?device=\"SUNWvga?' \
     75 		                -e 's?device=\"8514?device=\"SUNW8514?' \
     76 		                -e 's?InitFunc=\"vga?InitFunc=\"SUNWvga?' \
     77 		                -e 's?InitFunc=\"i8514?InitFunc=\"SUNW8514?' \
     78                  > /tmp/$$owconfig
     79 
     80 /usr/bin/nawk -v LKUP_TBL="/tmp/lookup_table" '
     81         BEGIN{
     82                 while (getline < LKUP_TBL > 0)
     83                    tab[$1] = $0		# Read entire lookup table
     84                                         # in memory.
     85 
     86              }
     87 
     88         /XINPUT/,/;/ {print}
     89 
     90         /XDISPLAY/,/;/ {print}
     91 
     92         /XSCREENCONFIG/,/;/ { split($0, owcfgflds, " ")
     93                               for (i=1; i <= NF; i++)
     94                                 {
     95                                   if (owcfgflds[i] ~ /pmifile/)
     96                                    j=split(owcfgflds[i], pmifld, "\"")
     97                                 }
     98 				#
     99                                 # Obtain the pmi filename (eg. ati.pmi)
    100                                 # from its absolute path.
    101                                 #
    102                                 k=split(pmifld[j-1], pmi, "/")
    103                                 pmifl = pmi[k]
    104 				#
    105                                 # If pmifile does not exist in the
    106                                 # lookup table then do not convert the
    107                                 # OWconfig file.
    108                                 #
    109                                 if (tab[pmifl] == "") {print}
    110                                 else
    111                                 {                                        
    112                                  split(tab[pmifl], lkupflds, " ")
    113                                  dev = lkupflds[2]
    114                                  xqa = lkupflds[3]
    115                                  vda = lkupflds[4]
    116                                  dep = lkupflds[5]
    117                                  ddx = lkupflds[6]
    118                                  ddi = lkupflds[7]
    119 
    120                                  for (l=1; l <= NF; l++)         
    121                                  {               
    122                                    if (owcfgflds[l] ~ /pmifile/) owcfgflds[l] = "board=""\""xqa"\" " "monitor=""\""vda"\""
    123                                    if (owcfgflds[l] ~ /device/) owcfgflds[l] = "device=""\""dev"\""
    124                                    printf "%s ", owcfgflds[l]
    125                                  }
    126                                  printf "\n"
    127 				 #
    128                                  # Create a new XSCREEN class 
    129                                  # corresponding to the modifications
    130                                  # made to the XSCREENCONFIG class.
    131                                  # Modifying the current XSCREEN class
    132 				 # is extremely difficult when multiple
    133 			  	 # instances of the XSCREENCONFIG class
    134 				 # are present.
    135 				 # 
    136                                  printf "class=\"XSCREEN\" "
    137                                  printf "name=\"%s\" ", dev
    138                                  printf "ddxHandler=\"%s\" ", ddx
    139                                  printf "ddxInitFunc=\"%s\";\n", ddi
    140                                 }
    141                             }
    142 
    143         /XSCREEN"/,/;/ {print}
    144 
    145 ' /tmp/$$owconfig > $TMP_FILE
    146 
    147 		mv $TMP_FILE $old
    148 		rm -f /tmp/lookup_table
    149 	else
    150 		touch $old
    151 		rm -f $TMP_FILE /tmp/lookup_table
    152 	fi
    153 done
    154 fi
    155 
    156 exit 0
    157