postinstall revision 7c478bd95313f5f23a4c958a745db2134aa03244
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in compliance
# with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#pragma ident "%Z%%M% %I% %E% SMI"
#
# SUNWcsd postinstall configuration
#
# To address various limitations of the packaging system with respect to
# driver files, we provide a somewhat improved system within this script.
# Driver file entries which must be created on the target system because
# they are needed BEFORE drvconfig runs on the subsequent re-configuration
# boot are added to the $prototype_* variable definitions below. This script
# processes these maps, creating driver nodes and symbolic links, and
# updating the software database as necessary.
#
# DO NOT add entries for drivers which are not needed before drvconfig runs
# DO NOT hardcode minor numbers for clone drivers (use the driver name instead)
#
# The prototype_com, prototype_sparc, and prototype_i386 variables defined
# below each consist of five whitespace-delimited columns, defined as follows:
#
# 1. Device Type - The single character 'b' (for block device) or 'c' (for
# character device). Used as an argument to installf(1M) and mknod(1M).
#
# 2. Device Path - Relative (should NOT begin with /) path to the device file
# to be created. This base is interpreted relative to $BASEDIR (typically /a).
#
# 3. Driver Name - The name of the driver which should be used to determine
# the major number for the device file. This name should match the name of
# a driver previously added to $BASEDIR/etc/name_to_major via add_drv.
#
# 4. Minor Number - The minor number for the device file. If the minor number
# is a sequence of digits, this literal minor number is used as the argument
# to mknod(1M). If it contains any non-digit characters, it is presumed to
# be the name of a driver, and the corresponding major number from the
# name_to_major file is substituted instead. This is useful for clone entries.
#
# 5. Symbolic Link - The symlink to the device path which should be created.
# This field may be left blank if no symlink is needed; if multiple links to
# the same device are required, entries may be repeated with different links.
# The link should be a relative path to which $BASEDIR can be prepended.
#
# Following its creation, the driver entry is assigned permissions and
# ownership according to the first matching entry in $BASEDIR/etc/minor_perm.
# This script uses the same algorithm as drvconfig(1M) to match minor_perm
# entries. If no matching minor_perm entry is found, mode 0600, owner "root",
# and group "sys" is assigned.
#
#
# Common driver entries:
#
'
#
# SPARC-specific driver entries:
#
'
#
# Intel-specific driver entries:
#
'
#
# SUNWcsd postinstall implementation
#
# Below this point is the code to process the above $prototype_* maps.
# You should not need to modify any code below this point to configure
# new drivers. You should also not need to add code here to remove
# nodes and links created by a previous version of this package; the
# pkghistory mechanism can be used to pkgrm SUNWcsd prior to its re-
# installation, which will remove everything created by this script.
#
#
# warn - Print an error message to stderr and also to our error log file
#
warn()
{
}
#
# name_to_major - Echo the major number of the given device driver to stdout.
#
{
}
#
# drv_alias - Return 0 (true) if $1 is a driver alias for $2
#
{
}
#
# Determine an appropriate place for our private error log file. If $PKGSAV
# error log primarily as a debugging facility.
#
break
fi
done
#
# If name_to_major or minor_perm is missing, then we're in big trouble (SUNWcsr
# isn't installed yet, or the file has been subsequently deleted).
#
warn "cannot proceed with device installation"
exit 1
fi
done
eval echo "\"\$prototype_com\"" "\"\$prototype_${ARCH}\"" | \
[ -z "$type" ] && continue # Skip blank lines
#
# Convert the driver name to the corresponding major number
# by looking it up in /etc/name_to_major.
#
if [ -z "$major" ]; then
continue
fi
#
# If the minor number does not consist solely of digits, we assume
# it too is the name of a driver (this is typically done for clone
# entries), and so we convert it to the driver's major number.
#
if [ -z "$minor_num" ]; then
continue
else
fi
fi
#
# Convert the driver path to two tokens used for matching entries in
# /etc/minor_perm: we strip the '@' address, and then obtain the
# drv_name (string prior to ':') and min_name (everything else).
#
drv_name="$1"; shift
min_name="$*"
#
# The logic here is a bit confusing, but matches the equally
# confusing logic used to parse minor_perm entries in the
# drvconfig change_perm() function.
#
( [ $drv_name = $mp_drvname ] && \
#
# If we have a driver name match, see if globbing the
# minor_perm pattern matches min_name.
#
break
;;
esac
fi
done
exec 0<&3 3>&- # Restore stdin to the $prototype_* pipeline
fi
else
continue
fi
if [ -n "$symlink" ]; then
#
# The link destination must be specified as an absolute path
# to installf. The source we modify to be relative to the
# destination (each "/" becomes a "../" prefix); thus
#
#
# We don't actually need to create the symlink at this time
# because the installf -f at the end will create all symlinks.
# We pipe the link description to installf instead of putting
# it on the command-line to work around installf broken-ness.
#
fi
done
cat << EOF > ${BASEDIR}/devices/README
Copyright 2002 Sun Microsystems, Inc. All rights reserved.
Use is subject to license terms.
This installation of Solaris uses devfs to provide /devices.
Warning: Do not change the content of this directory or its
subdirectories.
The directory containing this README file is typically hidden
underneath the /devices devfs(7FS) mount point. All content at or
below this directory is an implementation artifact and subject to
incompatible change or removal without notification.
Please reference devfs(7FS) for more information.
EOF
fi