i.nametomajor revision d8d4fa8f33f737d82c7dcd7ddd11b4342ce4fbca
919N/A# The contents of this file are subject to the terms of the 919N/A# Common Development and Distribution License (the "License"). 919N/A# You may not use this file except in compliance with the License. 919N/A# See the License for the specific language governing permissions 919N/A# and limitations under the License. 919N/A# When distributing Covered Code, include this CDDL HEADER in each 919N/A# If applicable, add the following below this CDDL HEADER, with the 919N/A# fields enclosed by brackets "[]" replaced with your own identifying 919N/A# information: Portions Copyright [yyyy] [name of copyright owner] 341N/A# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 341N/A# Use is subject to license terms. 341N/A# obsolete_sparc - Filter function to remove obsolete SPARC driver entries. 341N/A# We define an associative array of bad driver names, and then nawk out 341N/A# lines where the first token is defined in our array. 341N/A } !($1 in obs) { print $0 }' 341N/A# obsolete_i386 - Filter function to remove obsolete i386 driver entries. 341N/A# We define an associative array of bad driver names, and then nawk out 341N/A# lines where the first token is defined in our array. 341N/A } !($1 in obs) { print $0 }' 341N/A# Useful debugging which is reasonable to include in a production system: 341N/A# we copy the salient driver files to the package undo directory before 341N/A# doing any work. This will help diagnose add_drv errors before the system 341N/A# becomes an unbootable smoldering ruin. 341N/A# check if the driver specified is already installed. 341N/A# the second token must be the decimal digit. 341N/A# ignore a comment if exists. 341N/A $1 == driver && $2 ~ /^[0-9][0-9]*$/ \ 341N/A { found = 1; exit 0 } \ 341N/A { num = split($2, n_array, delimiter); \ 341N/A if (num > 1 && n_array[1] ~ /^[0-9][0-9]*$/) \ 341N/A { found = 1; exit 0 } \ 341N/A# some reason it has been removed, create an empty one at this time. 341N/A# script is invoked *after* this class-action script. This is critical 341N/A# because if we are going to add_drv a new driver 'foo', and 'foo' has 341N/A# an alias 'bar', the add_drv of 'foo' will fail if the alias is already 341N/A# present. Thus new aliases must be added *after* new driver major entries. 1064N/A# The driver_aliases class-action script will add the complete set of aliases 341N/A# if we create an empty file here, so this code allows us to continue and 341N/A# get a correct upgrade in the face of a missing driver_aliases file. 341N/A # Strip obsolete entries from the existing name_to_major 341N/A # Remove comment and/or blank lines before reading 341N/A # If the driver is already present in name_to_major, 341N/A # leave the existing number and continue 1064N/A # Otherwise add the driver to name_to_major using 341N/A # add_drv. add_drv produces spurious output even on 341N/A # success, so save its output in a temporary 341N/A # file in case an error occurs. 341N/A # If no name_to_major is present on the target system, 341N/A # just copy over the one from the package.