i.rOWconfig revision 7c478bd95313f5f23a4c958a745db2134aa03244
124N/A#!/bin/sh
124N/A#
124N/A# CDDL HEADER START
124N/A#
124N/A# The contents of this file are subject to the terms of the
124N/A# Common Development and Distribution License, Version 1.0 only
124N/A# (the "License"). You may not use this file except in compliance
124N/A# with the License.
124N/A#
124N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
124N/A# or http://www.opensolaris.org/os/licensing.
124N/A# See the License for the specific language governing permissions
124N/A# and limitations under the License.
124N/A#
124N/A# When distributing Covered Code, include this CDDL HEADER in each
124N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
124N/A# If applicable, add the following below this CDDL HEADER, with the
124N/A# fields enclosed by brackets "[]" replaced with your own identifying
124N/A# information: Portions Copyright [yyyy] [name of copyright owner]
124N/A#
5680N/A# CDDL HEADER END
5680N/A#
5230N/A#
124N/A#ident "%Z%%M% %I% %E% SMI"
5680N/A#
124N/A# Copyright (c) 1997 by Sun Microsystems, Inc.
124N/A# All rights reserved.
124N/A#
7140N/A
618N/A#
124N/A# $new is the new version of the file in the package. Unused.
844N/A# $old is the old version of the OWconfig file. We rewrite this.
7140N/A#
618N/A# We need to rewrite the following:
124N/A# directory names for PMI files that moved.
7140N/A# Three different cases (x2 - one for vga? and one for 8514)
5648N/A# where SUNW was placed in front of identifier - vga4, vga8, 8514
7243N/A#
7243N/A
7243N/Aif [ -h /etc/openwin/server/etc/OWconfig -a -f /tmp/root/etc/openwin/server/etc/OWconfig ]
7243N/Athen
5680N/A cp /tmp/root/etc/openwin/server/etc/OWconfig $PKG_INSTALL_ROOT/etc/openwin/server/etc/OWconfig
6695N/Aelse
6695N/Acat > /tmp/lookup_table <<EOT
6695N/Agxe_43.pmi SUNWs3 number9/gxe-2.xqa mfreq/mfreq38.vda 8 ddxSUNWs3.so.1 SUNWs3Init
6695N/Agxe_60.pmi SUNWs3 number9/gxe-2.xqa mfreq/mfreq48.vda 8 ddxSUNWs3.so.1 SUNWs3Init
5680N/Agxe_70.pmi SUNWs3 number9/gxe-2.xqa mfreq/mfreq56.vda 8 ddxSUNWs3.so.1 SUNWs3Init
124N/Amach32_60.pmi SUNWati ati/ultrapro2.xqa mfreq/mfreq64.vda 8 ddxSUNWati.so.1 SUNWatiInit
2960N/Amach32_70.pmi SUNWati ati/ultrapro2.xqa mfreq/mfreq64.vda 8 ddxSUNWati.so.1 SUNWatiInit
2960N/Amach32_72.pmi SUNWati ati/ultrapro2.xqa mfreq/mfreq64.vda 8 ddxSUNWati.so.1 SUNWatiInit
2960N/Amach32_76.pmi SUNWati ati/ultrapro2.xqa mfreq/mfreq80.vda 8 ddxSUNWati.so.1 SUNWatiInit
2960N/Amach32_87.pmi SUNWati ati/ultrapro2.xqa mfreq/mfreq85.vda 8 ddxSUNWati.so.1 SUNWatiInit
124N/Amach32_95.pmi SUNWati ati/ultrapro2.xqa mfreq/mfreq85.vda 8 ddxSUNWati.so.1 SUNWatiInit
124N/AEOT
5935N/A
5935N/ATMP_FILE=/tmp/`basename $0`.$$
5935N/Atrap 'rm -f $TMP_FILE /tmp/lookup_table' 0 1 2 3 15
5935N/A
7003N/Awhile read new old
7003N/Ado
7003N/A
5680N/A#
5680N/A# If there is no existing file, don't do any of this stuff.
124N/A# in that case, $old will be /dev/null
5617N/A#
124N/A if [ -f $old ]; then
124N/A echo "Converting old OWconfig file to new format."
124N/A cat $old |\
3878N/A /usr/bin/sed -e 's?vesa/vga?devdata/svpmi/SUNWvga?' \
7140N/A -e 's?vesa/8514?devdata/svpmi/SUNW8514?' \
5935N/A -e 's?name=\"vga?name=\"SUNWvga?' \
5935N/A -e 's?name=\"8514?name=\"SUNW8514?' \
124N/A -e 's?listOfScreens=\"vga?listOfScreens=\"SUNWvga?' \
765N/A -e 's?device=\"vga?device=\"SUNWvga?' \
765N/A -e 's?device=\"8514?device=\"SUNW8514?' \
765N/A -e 's?InitFunc=\"vga?InitFunc=\"SUNWvga?' \
765N/A -e 's?InitFunc=\"i8514?InitFunc=\"SUNW8514?' \
765N/A > /tmp/$$owconfig
1792N/A
1792N/A/usr/bin/nawk -v LKUP_TBL="/tmp/lookup_table" '
1792N/A BEGIN{
765N/A while (getline < LKUP_TBL > 0)
765N/A tab[$1] = $0 # Read entire lookup table
765N/A # in memory.
765N/A
765N/A }
6184N/A
6184N/A /XINPUT/,/;/ {print}
6184N/A
7003N/A /XDISPLAY/,/;/ {print}
6184N/A
6184N/A /XSCREENCONFIG/,/;/ { split($0, owcfgflds, " ")
7003N/A for (i=1; i <= NF; i++)
6184N/A {
3817N/A if (owcfgflds[i] ~ /pmifile/)
3817N/A j=split(owcfgflds[i], pmifld, "\"")
3817N/A }
3817N/A #
3817N/A # Obtain the pmi filename (eg. ati.pmi)
7140N/A # from its absolute path.
3817N/A #
3817N/A k=split(pmifld[j-1], pmi, "/")
5111N/A pmifl = pmi[k]
3817N/A #
3817N/A # If pmifile does not exist in the
3817N/A # lookup table then do not convert the
6067N/A # OWconfig file.
6067N/A #
3817N/A if (tab[pmifl] == "") {print}
3817N/A else
3817N/A {
3817N/A split(tab[pmifl], lkupflds, " ")
3817N/A dev = lkupflds[2]
xqa = lkupflds[3]
vda = lkupflds[4]
dep = lkupflds[5]
ddx = lkupflds[6]
ddi = lkupflds[7]
for (l=1; l <= NF; l++)
{
if (owcfgflds[l] ~ /pmifile/) owcfgflds[l] = "board=""\""xqa"\" " "monitor=""\""vda"\""
if (owcfgflds[l] ~ /device/) owcfgflds[l] = "device=""\""dev"\""
printf "%s ", owcfgflds[l]
}
printf "\n"
#
# Create a new XSCREEN class
# corresponding to the modifications
# made to the XSCREENCONFIG class.
# Modifying the current XSCREEN class
# is extremely difficult when multiple
# instances of the XSCREENCONFIG class
# are present.
#
printf "class=\"XSCREEN\" "
printf "name=\"%s\" ", dev
printf "ddxHandler=\"%s\" ", ddx
printf "ddxInitFunc=\"%s\";\n", ddi
}
}
/XSCREEN"/,/;/ {print}
' /tmp/$$owconfig > $TMP_FILE
mv $TMP_FILE $old
rm -f /tmp/lookup_table
else
touch $old
rm -f $TMP_FILE /tmp/lookup_table
fi
done
fi
exit 0