OpenSolaris_b135/pkgdefs/SUNWcsd/postinstall

#!/bin/sh
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (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
# or http://www.opensolaris.org/os/licensing.
# 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 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

PATH="/usr/bin:/usr/sbin:$PATH"; export PATH

#
# SUNWcsd postinstall configuration
#
# This file supplies /dev links needed in the install miniroot. The link
# targets are automatically created by devfs as driver attaches.
# The prototype_com, prototype_sparc, and prototype_i386 variables defined
# below each consist of two whitespace-delimited columns, defined as follows:
#
# 1. Device Path - Relative (should NOT begin with /) path to the device file
# to be created.  This base is interpreted relative to $BASEDIR (typically /a).
#
# 2. Symbolic Link - The symlink to the device path which should be created.
# The link should be a relative path to which $BASEDIR can be prepended.
#

#
# Common driver entries:
#
prototype_com='
devices/pseudo/arp@0:arp              dev/arp
devices/pseudo/clone@0:ibd            dev/ibd
devices/pseudo/dld@0:ctl              dev/dld
devices/pseudo/dlpistub@0:ipmpstub    dev/ipmpstub
devices/pseudo/icmp@0:icmp            dev/icmp
devices/pseudo/icmp@0:icmp            dev/rawip
devices/pseudo/icmp6@0:icmp6          dev/icmp6
devices/pseudo/icmp6@0:icmp6          dev/rawip6
devices/pseudo/ip@0:ip                dev/ip
devices/pseudo/ip6@0:ip6              dev/ip6
devices/pseudo/rts@0:rts              dev/rts
devices/pseudo/tcp@0:tcp              dev/tcp
devices/pseudo/tcp6@0:tcp6            dev/tcp6
devices/pseudo/udp@0:udp              dev/udp
devices/pseudo/udp6@0:udp6            dev/udp6
devices/pseudo/ipsecah@0:ipsecah      dev/ipsecah
devices/pseudo/ipsecesp@0:ipsecesp    dev/ipsecesp
devices/pseudo/keysock@0:keysock      dev/keysock
devices/pseudo/cn@0:console           dev/console
devices/pseudo/cn@0:syscon            dev/syscon
devices/pseudo/cn@0:systty            dev/systty
devices/pseudo/ksyms@0:ksyms          dev/ksyms
devices/pseudo/log@0:conslog          dev/conslog
devices/pseudo/log@0:log              dev/log
devices/pseudo/mm@0:mem               dev/mem
devices/pseudo/mm@0:kmem              dev/kmem
devices/pseudo/mm@0:null              dev/null
devices/pseudo/mm@0:allkmem           dev/allkmem
devices/pseudo/mm@0:zero              dev/zero
devices/pseudo/openeepr@0:openprom    dev/openprom
devices/pseudo/pm@0:pm                dev/pm
devices/pseudo/sad@0:admin            dev/sad/admin
devices/pseudo/sad@0:user             dev/sad/user
devices/pseudo/sy@0:tty               dev/tty
devices/pseudo/sysevent@0:sysevent    dev/sysevent
devices/pseudo/sysmsg@0:msglog        dev/msglog
devices/pseudo/sysmsg@0:sysmsg        dev/sysmsg
devices/pseudo/tl@0:ticots            dev/ticots
devices/pseudo/tl@0:ticotsord         dev/ticotsord
devices/pseudo/tl@0:ticlts            dev/ticlts
devices/pseudo/wc@0:wscons            dev/wscons
devices/pseudo/zfs@0:zfs              dev/zfs
'

#
# SPARC-specific driver entries:
#
prototype_sparc='
'

#
# Intel-specific driver entries:
#
prototype_i386='
devices/pseudo/conskbd@0:kbd          dev/kbd
'

#
# 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
# links created by a previous version of this package. All the links
# can also be created by devfsadm link generators; the reason they
# are also here is for the initial boot (miniroot or diskless client)
# where certain devices must be present to get to the point when
# devfsadm runs.
#

#
# Determine an appropriate place for our private error log file.  If $PKGSAV
# is available, use that; otherwise use /tmp or /dev/null.  We keep a private
# error log primarily as a debugging facility.
#
errlog=/dev/null
for file in $PKGSAV/SUNWcsd.err /tmp/SUNWcsd.err; do
	rm -f $file
	if touch $file >/dev/null 2>&1; then
		errlog=$file
		break
	fi
done

eval echo "\"\$prototype_com\"" "\"\$prototype_${ARCH}\"" | \
while read path symlink; do

	[ -z "$path" ] && continue	# Skip blank lines

	#
	# 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
	# linkdst "dev/foo/bar" yields prefix "../../".
	#
	lprefix=`echo "$symlink" | sed 's:[^/]*::g;s:/:../:g'`
	linksrc="$lprefix$path"
	linkdst="/$symlink"

	if [ ! -L ${BASEDIR}$linkdst ]; then
		echo "add link $linkdst=$linksrc"
		ln -s $linksrc ${BASEDIR}$linkdst
	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

if [ -f ${BASEDIR}/devices/README ]; then
	chown root:sys ${BASEDIR}/devices/README
	chmod 444 ${BASEDIR}/devices/README
fi

exit 0