Home | History | Annotate | Download | only in SUNWcsd
      1 #!/bin/sh
      2 #
      3 # CDDL HEADER START
      4 #
      5 # The contents of this file are subject to the terms of the
      6 # Common Development and Distribution License (the "License").
      7 # You may not use this file except in compliance with the License.
      8 #
      9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     10 # or http://www.opensolaris.org/os/licensing.
     11 # See the License for the specific language governing permissions
     12 # and limitations under the License.
     13 #
     14 # When distributing Covered Code, include this CDDL HEADER in each
     15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     16 # If applicable, add the following below this CDDL HEADER, with the
     17 # fields enclosed by brackets "[]" replaced with your own identifying
     18 # information: Portions Copyright [yyyy] [name of copyright owner]
     19 #
     20 # CDDL HEADER END
     21 #
     22 #
     23 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
     24 # Use is subject to license terms.
     25 #
     26 
     27 PATH="/usr/bin:/usr/sbin:$PATH"; export PATH
     28 
     29 #
     30 # SUNWcsd postinstall configuration
     31 #
     32 # This file supplies /dev links needed in the install miniroot. The link
     33 # targets are automatically created by devfs as driver attaches.
     34 # The prototype_com, prototype_sparc, and prototype_i386 variables defined
     35 # below each consist of two whitespace-delimited columns, defined as follows:
     36 #
     37 # 1. Device Path - Relative (should NOT begin with /) path to the device file
     38 # to be created.  This base is interpreted relative to $BASEDIR (typically /a).
     39 #
     40 # 2. Symbolic Link - The symlink to the device path which should be created.
     41 # The link should be a relative path to which $BASEDIR can be prepended.
     42 #
     43 
     44 #
     45 # Common driver entries:
     46 #
     47 prototype_com='
     48 devices/pseudo/arp@0:arp              dev/arp
     49 devices/pseudo/clone@0:ibd            dev/ibd
     50 devices/pseudo/dld@0:ctl              dev/dld
     51 devices/pseudo/icmp@0:icmp            dev/icmp
     52 devices/pseudo/icmp@0:icmp            dev/rawip
     53 devices/pseudo/icmp6@0:icmp6          dev/icmp6
     54 devices/pseudo/icmp6@0:icmp6          dev/rawip6
     55 devices/pseudo/ip@0:ip                dev/ip
     56 devices/pseudo/ip6@0:ip6              dev/ip6
     57 devices/pseudo/rts@0:rts              dev/rts
     58 devices/pseudo/tcp@0:tcp              dev/tcp
     59 devices/pseudo/tcp6@0:tcp6            dev/tcp6
     60 devices/pseudo/udp@0:udp              dev/udp
     61 devices/pseudo/udp6@0:udp6            dev/udp6
     62 devices/pseudo/ipsecah@0:ipsecah      dev/ipsecah
     63 devices/pseudo/ipsecesp@0:ipsecesp    dev/ipsecesp
     64 devices/pseudo/keysock@0:keysock      dev/keysock
     65 devices/pseudo/cn@0:console           dev/console
     66 devices/pseudo/cn@0:syscon            dev/syscon
     67 devices/pseudo/cn@0:systty            dev/systty
     68 devices/pseudo/ksyms@0:ksyms          dev/ksyms
     69 devices/pseudo/log@0:conslog          dev/conslog
     70 devices/pseudo/log@0:log              dev/log
     71 devices/pseudo/mm@0:mem               dev/mem
     72 devices/pseudo/mm@0:kmem              dev/kmem
     73 devices/pseudo/mm@0:null              dev/null
     74 devices/pseudo/mm@0:allkmem           dev/allkmem
     75 devices/pseudo/mm@0:zero              dev/zero
     76 devices/pseudo/openeepr@0:openprom    dev/openprom
     77 devices/pseudo/pm@0:pm                dev/pm
     78 devices/pseudo/sad@0:admin            dev/sad/admin
     79 devices/pseudo/sad@0:user             dev/sad/user
     80 devices/pseudo/sy@0:tty               dev/tty
     81 devices/pseudo/sysevent@0:sysevent    dev/sysevent
     82 devices/pseudo/sysmsg@0:msglog        dev/msglog
     83 devices/pseudo/sysmsg@0:sysmsg        dev/sysmsg
     84 devices/pseudo/tl@0:ticots            dev/ticots
     85 devices/pseudo/tl@0:ticotsord         dev/ticotsord
     86 devices/pseudo/tl@0:ticlts            dev/ticlts
     87 devices/pseudo/wc@0:wscons            dev/wscons
     88 devices/pseudo/zfs@0:zfs              dev/zfs
     89 '
     90 
     91 #
     92 # SPARC-specific driver entries:
     93 #
     94 prototype_sparc='
     95 '
     96 
     97 #
     98 # Intel-specific driver entries:
     99 #
    100 prototype_i386='
    101 devices/pseudo/conskbd@0:kbd          dev/kbd
    102 '
    103 
    104 #
    105 # SUNWcsd postinstall implementation
    106 #
    107 # Below this point is the code to process the above $prototype_* maps.
    108 # You should not need to modify any code below this point to configure
    109 # new drivers.  You should also not need to add code here to remove
    110 # links created by a previous version of this package. All the links
    111 # can also be created by devfsadm link generators; the reason they
    112 # are also here is for the initial boot (miniroot or diskless client)
    113 # where certain devices must be present to get to the point when
    114 # devfsadm runs.
    115 #
    116 
    117 #
    118 # Determine an appropriate place for our private error log file.  If $PKGSAV
    119 # is available, use that; otherwise use /tmp or /dev/null.  We keep a private
    120 # error log primarily as a debugging facility.
    121 #
    122 errlog=/dev/null
    123 for file in $PKGSAV/SUNWcsd.err /tmp/SUNWcsd.err; do
    124 	rm -f $file
    125 	if touch $file >/dev/null 2>&1; then
    126 		errlog=$file
    127 		break
    128 	fi
    129 done
    130 
    131 eval echo "\"\$prototype_com\"" "\"\$prototype_${ARCH}\"" | \
    132 while read path symlink; do
    133 
    134 	[ -z "$path" ] && continue	# Skip blank lines
    135 
    136 	#
    137 	# The link destination must be specified as an absolute path
    138 	# to installf.  The source we modify to be relative to the
    139 	# destination (each "/" becomes a "../" prefix); thus
    140 	# linkdst "dev/foo/bar" yields prefix "../../".
    141 	#
    142 	lprefix=`echo "$symlink" | sed 's:[^/]*::g;s:/:../:g'`
    143 	linksrc="$lprefix$path"
    144 	linkdst="/$symlink"
    145 
    146 	if [ ! -L ${BASEDIR}$linkdst ]; then
    147 		echo "add link $linkdst=$linksrc"
    148 		ln -s $linksrc ${BASEDIR}$linkdst
    149 	fi
    150 done
    151 
    152 cat << EOF > ${BASEDIR}/devices/README
    153 
    154 Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
    155 Use is subject to license terms.
    156 
    157  This installation of Solaris uses devfs to provide /devices.
    158 
    159 Warning: Do not change the content of this directory or its
    160          subdirectories.
    161 
    162  The directory containing this README file is typically hidden
    163 underneath the /devices devfs(7FS) mount point.  All content at or
    164 below this directory is an implementation artifact and subject to
    165 incompatible change or removal without notification.
    166 
    167  Please reference devfs(7FS) for more information.
    168 
    169 EOF
    170 
    171 if [ -f ${BASEDIR}/devices/README ]; then
    172 	chown root:sys ${BASEDIR}/devices/README
    173 	chmod 444 ${BASEDIR}/devices/README
    174 fi
    175 
    176 exit 0
    177