i.nametomajor revision 4ab75253616c6d68e967c10221bb663c0bfa99df
6bdda696b3ea703c47e87fea61017ec655f91d92nd#!/bin/sh
6bdda696b3ea703c47e87fea61017ec655f91d92nd#
6bdda696b3ea703c47e87fea61017ec655f91d92nd# CDDL HEADER START
6bdda696b3ea703c47e87fea61017ec655f91d92nd#
6bdda696b3ea703c47e87fea61017ec655f91d92nd# The contents of this file are subject to the terms of the
6bdda696b3ea703c47e87fea61017ec655f91d92nd# Common Development and Distribution License (the "License").
6bdda696b3ea703c47e87fea61017ec655f91d92nd# You may not use this file except in compliance with the License.
6bdda696b3ea703c47e87fea61017ec655f91d92nd#
6bdda696b3ea703c47e87fea61017ec655f91d92nd# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
6bdda696b3ea703c47e87fea61017ec655f91d92nd# or http://www.opensolaris.org/os/licensing.
0662ed52e814f8f08ef0e09956413a792584eddffuankg# See the License for the specific language governing permissions
6bdda696b3ea703c47e87fea61017ec655f91d92nd# and limitations under the License.
6bdda696b3ea703c47e87fea61017ec655f91d92nd#
6bdda696b3ea703c47e87fea61017ec655f91d92nd# When distributing Covered Code, include this CDDL HEADER in each
6bdda696b3ea703c47e87fea61017ec655f91d92nd# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
6bdda696b3ea703c47e87fea61017ec655f91d92nd# If applicable, add the following below this CDDL HEADER, with the
6bdda696b3ea703c47e87fea61017ec655f91d92nd# fields enclosed by brackets "[]" replaced with your own identifying
6bdda696b3ea703c47e87fea61017ec655f91d92nd# information: Portions Copyright [yyyy] [name of copyright owner]
6bdda696b3ea703c47e87fea61017ec655f91d92nd#
6bdda696b3ea703c47e87fea61017ec655f91d92nd# CDDL HEADER END
16b55a35cff91315d261d1baa776138af465c4e4fuankg#
16b55a35cff91315d261d1baa776138af465c4e4fuankg
16b55a35cff91315d261d1baa776138af465c4e4fuankg#
6bdda696b3ea703c47e87fea61017ec655f91d92nd# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
6bdda696b3ea703c47e87fea61017ec655f91d92nd# Use is subject to license terms.
6bdda696b3ea703c47e87fea61017ec655f91d92nd#
6bdda696b3ea703c47e87fea61017ec655f91d92nd#ident "%Z%%M% %I% %E% SMI"
6bdda696b3ea703c47e87fea61017ec655f91d92nd
6bdda696b3ea703c47e87fea61017ec655f91d92ndPATH=/usr/bin:/usr/sbin:$PATH; export PATH
6bdda696b3ea703c47e87fea61017ec655f91d92nd
6bdda696b3ea703c47e87fea61017ec655f91d92nd#
6bdda696b3ea703c47e87fea61017ec655f91d92nd# add_major - adds new major numbers to system for device drivers on older
6bdda696b3ea703c47e87fea61017ec655f91d92nd# Solaris systems where add_drv -b was not available or had bugs. This
6bdda696b3ea703c47e87fea61017ec655f91d92nd# code will be removed when doing a server_upgrade on systems with missing
6bdda696b3ea703c47e87fea61017ec655f91d92nd# or broken add_drv is eventually EOL'd. DO NOT COPY THIS CODE TO OTHER
6bdda696b3ea703c47e87fea61017ec655f91d92nd# PACKAGE SCRIPTS!
6bdda696b3ea703c47e87fea61017ec655f91d92nd#
6bdda696b3ea703c47e87fea61017ec655f91d92ndadd_major()
6bdda696b3ea703c47e87fea61017ec655f91d92nd{
6bdda696b3ea703c47e87fea61017ec655f91d92nd tmpfile=/tmp/nm.$$.tmp
6bdda696b3ea703c47e87fea61017ec655f91d92nd
6bdda696b3ea703c47e87fea61017ec655f91d92nd if [ -f $BASEDIR/etc/rem_name_to_major ]; then
6bdda696b3ea703c47e87fea61017ec655f91d92nd rem_file="$BASEDIR/etc/rem_name_to_major"
6bdda696b3ea703c47e87fea61017ec655f91d92nd fi
6bdda696b3ea703c47e87fea61017ec655f91d92nd
6bdda696b3ea703c47e87fea61017ec655f91d92nd sort +1 -2n $dest $rem_file | nawk '#
6bdda696b3ea703c47e87fea61017ec655f91d92ndBEGIN {oldmajor = -1}
6bdda696b3ea703c47e87fea61017ec655f91d92ndNR == 1 {n=split(namelist,x)
6bdda696b3ea703c47e87fea61017ec655f91d92nd if (n < 1)
6bdda696b3ea703c47e87fea61017ec655f91d92nd exit(1)
6bdda696b3ea703c47e87fea61017ec655f91d92nd for (i=1; i<=n; i++)
6bdda696b3ea703c47e87fea61017ec655f91d92nd chklist[x[i]]++
6bdda696b3ea703c47e87fea61017ec655f91d92nd }
6bdda696b3ea703c47e87fea61017ec655f91d92nd {for (name in chklist)
6bdda696b3ea703c47e87fea61017ec655f91d92nd {
6bdda696b3ea703c47e87fea61017ec655f91d92nd if ($1 == name)
6bdda696b3ea703c47e87fea61017ec655f91d92nd delete chklist[name]
6bdda696b3ea703c47e87fea61017ec655f91d92nd }
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg if (($2 - oldmajor) > 1)
6bdda696b3ea703c47e87fea61017ec655f91d92nd {
6bdda696b3ea703c47e87fea61017ec655f91d92nd gap++
6bdda696b3ea703c47e87fea61017ec655f91d92nd gaplist[gap] = oldmajor " " $2;
6bdda696b3ea703c47e87fea61017ec655f91d92nd }
6bdda696b3ea703c47e87fea61017ec655f91d92nd oldmajor = $2;
6bdda696b3ea703c47e87fea61017ec655f91d92nd }
6bdda696b3ea703c47e87fea61017ec655f91d92ndEND {addsize=1
6bdda696b3ea703c47e87fea61017ec655f91d92nd for (name in chklist)
6bdda696b3ea703c47e87fea61017ec655f91d92nd addlist[addsize++] = name
6bdda696b3ea703c47e87fea61017ec655f91d92nd
6bdda696b3ea703c47e87fea61017ec655f91d92nd addidx = 1
6bdda696b3ea703c47e87fea61017ec655f91d92nd for (i=1; i<=gap && addidx < addsize; i++)
6bdda696b3ea703c47e87fea61017ec655f91d92nd {
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg split(gaplist[i],x)
6bdda696b3ea703c47e87fea61017ec655f91d92nd begmajor = x[1]
6bdda696b3ea703c47e87fea61017ec655f91d92nd endmajor = x[2]
6bdda696b3ea703c47e87fea61017ec655f91d92nd for (begmajor++;begmajor < endmajor && addidx < addsize;)
6bdda696b3ea703c47e87fea61017ec655f91d92nd {
6bdda696b3ea703c47e87fea61017ec655f91d92nd printf "%s %d\n",addlist[addidx],begmajor
6bdda696b3ea703c47e87fea61017ec655f91d92nd addidx++
6bdda696b3ea703c47e87fea61017ec655f91d92nd begmajor++
6bdda696b3ea703c47e87fea61017ec655f91d92nd }
6bdda696b3ea703c47e87fea61017ec655f91d92nd }
6bdda696b3ea703c47e87fea61017ec655f91d92nd for (; addidx < addsize; addidx++)
6bdda696b3ea703c47e87fea61017ec655f91d92nd {
6bdda696b3ea703c47e87fea61017ec655f91d92nd oldmajor++
6bdda696b3ea703c47e87fea61017ec655f91d92nd printf "%s %d\n",addlist[addidx],oldmajor
6bdda696b3ea703c47e87fea61017ec655f91d92nd }
6bdda696b3ea703c47e87fea61017ec655f91d92nd }
6bdda696b3ea703c47e87fea61017ec655f91d92nd' namelist="$*" - > $tmpfile
6bdda696b3ea703c47e87fea61017ec655f91d92nd
6bdda696b3ea703c47e87fea61017ec655f91d92nd if [ -s $tmpfile ]; then
6bdda696b3ea703c47e87fea61017ec655f91d92nd echo "Adding the following devices to $dest :"
6bdda696b3ea703c47e87fea61017ec655f91d92nd cat $tmpfile
6bdda696b3ea703c47e87fea61017ec655f91d92nd sort +1 -2n $dest $tmpfile -o $dest
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg fi
6bdda696b3ea703c47e87fea61017ec655f91d92nd
6bdda696b3ea703c47e87fea61017ec655f91d92nd rm -f $tmpfile
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg}
6bdda696b3ea703c47e87fea61017ec655f91d92nd
6bdda696b3ea703c47e87fea61017ec655f91d92nd#
6bdda696b3ea703c47e87fea61017ec655f91d92nd# obsolete_sparc - Filter function to remove obsolete SPARC driver entries.
6bdda696b3ea703c47e87fea61017ec655f91d92nd# We define an associative array of bad driver names, and then nawk out
6bdda696b3ea703c47e87fea61017ec655f91d92nd# lines where the first token is defined in our array.
6bdda696b3ea703c47e87fea61017ec655f91d92nd#
6bdda696b3ea703c47e87fea61017ec655f91d92ndobsolete_sparc()
6bdda696b3ea703c47e87fea61017ec655f91d92nd{
6bdda696b3ea703c47e87fea61017ec655f91d92nd nawk 'BEGIN {
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["rip"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["svloop"] = 1;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg obs["tcl"] = 1;
0662ed52e814f8f08ef0e09956413a792584eddffuankg obs["tco"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["tcoo"] = 1;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg obs["sp"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["consfb"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["dbri"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["XXunusedXX"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["sw"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["cgtwo"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["xy"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["xd"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["pc"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["app"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["evq"] = 1;
0662ed52e814f8f08ef0e09956413a792584eddffuankg obs["win"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["svarp"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["svip"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["svrip"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["svicmp"] = 1;
0662ed52e814f8f08ef0e09956413a792584eddffuankg obs["svudp"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["svtcp"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["vme"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["ie"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["qe"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["qec"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["ncr"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["xt"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["id"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["vmemem"] = 1;
0662ed52e814f8f08ef0e09956413a792584eddffuankg obs["pn"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["kmac"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["ipi3sc"] = 1;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg obs["cgfour"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["cgeight-p4"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["xdc"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["xyc"] = 1;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg obs["mcp"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["mcpzsa"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["mcpp"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["be"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["p9000"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["p9100"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["pci"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["profile"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["eeprom"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["PFUaga"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["atapicd"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["cgeight"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["cgfourteen"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["xbox"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["sx"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["sx_cmem"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["stc"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["bbc"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["gptwo"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["bwtwo"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["cgthree"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["obio"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["cpu"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["bootbus"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["sbi"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["mic"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["pln"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["soc"] = 1;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg obs["sc_nct"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["tomtppm"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd } !($1 in obs) { print $1, $2 }'
6bdda696b3ea703c47e87fea61017ec655f91d92nd}
6bdda696b3ea703c47e87fea61017ec655f91d92nd
6bdda696b3ea703c47e87fea61017ec655f91d92nd#
6bdda696b3ea703c47e87fea61017ec655f91d92nd# obsolete_i386 - Filter function to remove obsolete i386 driver entries.
6bdda696b3ea703c47e87fea61017ec655f91d92nd# We define an associative array of bad driver names, and then nawk out
6bdda696b3ea703c47e87fea61017ec655f91d92nd# lines where the first token is defined in our array.
6bdda696b3ea703c47e87fea61017ec655f91d92nd#
6bdda696b3ea703c47e87fea61017ec655f91d92ndobsolete_i386()
6bdda696b3ea703c47e87fea61017ec655f91d92nd{
6bdda696b3ea703c47e87fea61017ec655f91d92nd nawk 'BEGIN {
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["aha"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["aic"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["app"] = 1;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg obs["audiocs"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["blogic"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["chanmux"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["chs"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["cmtp"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["corvette"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["cpqncr"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["csa"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["dpt"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["dsa"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["eepro"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["eha"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["el"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["elink"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["elx"] = 1;
8ffac2c334103c0336602aaede650cb578611151fuankg obs["envm"] = 1;
8ffac2c334103c0336602aaede650cb578611151fuankg obs["esa"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["esa"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["iee"] = 1;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg obs["ieef"] = 1;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg obs["iss"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["kd"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["kdmouse"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["lp"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["mc"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["mcis"] = 1;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg obs["mega"] = 1;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg obs["mlx"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["nee"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["nei"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["nfe"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["objmgr"] = 1;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg obs["p9000"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["p9100"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["pcaic"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["profile"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["riles"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["rip"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["smartii"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["smc"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["smce"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["smceu"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["smcf"] = 1;
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg obs["sp"] = 1;
0662ed52e814f8f08ef0e09956413a792584eddffuankg obs["svarp"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["svicmp"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["svip"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["svloop"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["svrip"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["svtcp"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["svudp"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["tcl"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["tco"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["tcoo"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["tiqmouse"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["tr"] = 1;
6bdda696b3ea703c47e87fea61017ec655f91d92nd obs["trantor"] = 1;
0662ed52e814f8f08ef0e09956413a792584eddffuankg } !($1 in obs) { print $1, $2 }'
6bdda696b3ea703c47e87fea61017ec655f91d92nd}
ac7985784d08a3655291f24f711812b4d8b1cbcffuankg
#
# Useful debugging which is reasonable to include in a production system:
# we copy the salient driver files to the package undo directory before
# doing any work. This will help diagnose add_drv errors before the system
# becomes an unbootable smoldering ruin.
#
for file in driver_aliases driver_classes minor_perm name_to_major; do
cp $BASEDIR/etc/$file $PKGSAV/$file.orig >/dev/null 2>&1
done
#
# Add_drv needs /etc/driver_aliases in order to work properly; if for
# some reason it has been removed, create an empty one at this time.
# Recall that in SUNWcsr's pkginfo.tmpl, the driver_aliases class-action
# script is invoked *after* this class-action script. This is critical
# because if we are going to add_drv a new driver 'foo', and 'foo' has
# an alias 'bar', the add_drv of 'foo' will fail if the alias is already
# present. Thus new aliases must be added *after* new driver major entries.
# The driver_aliases class-action script will add the complete set of aliases
# if we create an empty file here, so this code allows us to continue and
# get a correct upgrade in the face of a missing driver_aliases file.
#
if [ ! -f $BASEDIR/etc/driver_aliases ]; then
touch $BASEDIR/etc/driver_aliases
chmod 0644 $BASEDIR/etc/driver_aliases
chown root $BASEDIR/etc/driver_aliases
chgrp sys $BASEDIR/etc/driver_aliases
fi
while read src dest; do
if [ -f $dest ]; then
#
# Strip obsolete entries from the existing name_to_major
#
if [ $ARCH = sparc ]; then
obsolete_sparc < $dest > /tmp/onm.$$.tmp
else
obsolete_i386 < $dest > /tmp/onm.$$.tmp
fi
cp /tmp/onm.$$.tmp $dest
rm -f /tmp/onm.$$.tmp
# PKG_CLIENT_VERSION is provided by PSARC 2001/472 for allowing
# package developers to inspect a client's OS VERSION from
# within a package procedure script. It returns following
# possible OS VERSION #'s(up to S10): 2.3, 2.4, 2.5, 2.5.1, 2.6
# 2.7, 8, 9, 10...
if [ "$PKG_CLIENT_VERSION" ]; then
# remove the leading "2.", if any
os_rev=`echo $PKG_CLIENT_VERSION | sed -e 's/^2\.//'`
else
# fall back to use "uname" and remove the leading "5."
os_rev=`uname -r | sed -e 's/^5\.//'`
fi
while read name major; do
#
# If the driver is already present in name_to_major,
# leave the existing number and continue
#
grep -w $name $dest >/dev/null 2>&1 && continue
#
# Otherwise add the driver to name_to_major using
# add_major or add_drv:
#
case $os_rev in
"3") add_major $name;;
"4") add_major $name;;
"5") add_major $name;;
"5.1") add_major $name;;
*)
#
# add_drv produces spurious output even on
# success, so save its output in a temporary
# file in case an error occurs.
#
if add_drv -b $BASEDIR $name \
>/tmp/ad.$$.tmp 2>&1; then
echo "added $name to $dest"
else
echo "$PKG: failed to add $name to " \
"$dest:" >& 2
cat /tmp/ad.$$.tmp >& 2
fi
;;
esac
done < $src
rm -f /tmp/ad.$$.tmp
else
#
# If no name_to_major is present on the target system,
# just copy over the one from the package.
#
cp -p $src $dest
fi
sort +1 -2n -o $dest $dest
done
exit 0