Home | History | Annotate | Download | only in method
      1 #!/sbin/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, Version 1.0 only
      7 # (the "License").  You may not use this file except in compliance
      8 # with the License.
      9 #
     10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
     11 # or http://www.opensolaris.org/os/licensing.
     12 # See the License for the specific language governing permissions
     13 # and limitations under the License.
     14 #
     15 # When distributing Covered Code, include this CDDL HEADER in each
     16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     17 # If applicable, add the following below this CDDL HEADER, with the
     18 # fields enclosed by brackets "[]" replaced with your own identifying
     19 # information: Portions Copyright [yyyy] [name of copyright owner]
     20 #
     21 # CDDL HEADER END
     22 #
     23 #
     24 # Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
     25 # Use is subject to license terms.
     26 #
     27 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
     28 # All rights reserved.
     29 #
     30 #
     31 # ident	"@(#)devices-local	1.3	05/06/08 SMI"
     32 
     33 # GLXXX - The SysV copyright should be unnecessary now?
     34 
     35 # Initiate the device reconfiguration process in case we need some
     36 # device links established so that we can successfully perform our
     37 # remaining standard mounts.
     38 
     39 if [ `/sbin/zonename` != "global" ]; then
     40 	exit 0
     41 fi
     42 
     43 /usr/bin/svcprop -q -p system/reconfigure system/svc/restarter:default
     44 if [ $? -eq 0 -o -f /.livecd ]; then
     45 	echo "\rConfiguring devices." > /dev/msglog
     46 	/usr/sbin/devfsadm >/dev/msglog 2>&1
     47         if [ -x /usr/ucb/ucblinks -a -f /usr/ucblib/ucblinks.awk ]; then
     48                 /usr/ucb/ucblinks >/dev/null 2>&1
     49         fi
     50 
     51 	#
     52 	# Flush any existing socket mappings since the major numbers of
     53 	# the device files may have changed.
     54 	#
     55 	/usr/bin/awk '/^[^#]/ { print $1, $2, $3 }' /etc/sock2path | \
     56 		/sbin/soconfig -f /dev/fd/0 >/dev/null 2>&1
     57 	/sbin/soconfig -f /etc/sock2path >/dev/null 2>&1
     58 
     59 	#
     60 	# Update kernel driver.conf cache.
     61 	#
     62 	/usr/sbin/devfsadm -I
     63 fi
     64 
     65 # Establish the default framebuffer name.
     66 
     67 fbdev=`/usr/sbin/prtconf -F 2>/dev/null`
     68 
     69 if [ $? -eq 0 ]; then
     70 	set -- /devices$fbdev*
     71 	if [ -c $1 ]; then
     72 		/usr/bin/rm -f /dev/fb
     73 		/usr/bin/ln -s $1 /dev/fb
     74 	fi
     75 fi
     76 
     77 
     78 if [ ! -f /.livecd ]
     79 then
     80 
     81 	# Create any zvol devices
     82 	if [ -x /usr/sbin/zfs ]; then
     83       	/usr/sbin/zfs volinit || exit $SMF_EXIT_ERR_FATAL
     84 	fi
     85 
     86 	exit 0
     87 
     88 fi
     89 
     90 #
     91 # Mount all disk devices. Our LiveCD cdrom has already been
     92 # mounted under /.cdrom . All other disks/partitions are mounted
     93 # under /mnt
     94 #
     95 cdnum=0
     96 fat=0
     97 dvd=0
     98 solaris=0
     99 swp=""
    100 echo "Mounting local partitions/cdroms" > /dev/msglog
    101 volumeid=`cat /.volumeid`
    102 mntpt=""
    103 
    104 for dnode in /dev/dsk/*
    105 do
    106        type=`/usr/sbin/fstyp $dnode 2> /dev/null`
    107        if [ "x$type" = "xhsfs" ]
    108        then
    109                # Is this our LiveCD cdrom ?
    110                /usr/lib/fs/hsfs/fstyp -v $dnode 2>&1 | grep "Volume id: $volumeid" > /dev/null
    111                if [ $? -ne 0 ]
    112                then
    113                        /usr/bin/mkdir /mnt/cdrom$cdnum
    114                        /sbin/mount -F hsfs -o ro $dnode /mnt/cdrom$cdnum
    115 #		       echo "$dnode -       /mnt/cdrom$cdnum hsfs    -        no        -" >> /etc/vfstab
    116                        cdnum=`/usr/bin/expr $cdnum + 1`
    117                fi
    118        else
    119 
    120                if [ "x$type" = "xudfs" ]
    121                then
    122                        /usr/bin/mkdir /mnt/dvd$dvd
    123                        /sbin/mount -F $type -o ro $dnode /mnt/dvd$dvd
    124 #		       echo "$dnode -       /mnt/dvd$dvd   udfs    -        no        -" >> /etc/vfstab
    125                        dvd=`/usr/bin/expr $dvd + 1`
    126 
    127                elif [ "x$type" = "xpcfs" ]
    128                then
    129                        /usr/bin/mkdir /mnt/fat$fat
    130                        /sbin/mount -F $type $dnode /mnt/fat$fat
    131 #		       echo "$dnode -       /mnt/fat$fat   pcfs    -        no        -" >> /etc/vfstab
    132                        fat=`/usr/bin/expr $fat + 1`
    133 
    134                elif [ "x$type" = "xufs" ]
    135                then
    136                        /usr/bin/mkdir /mnt/solaris$solaris
    137                        /sbin/mount -F $type $dnode /mnt/solaris$solaris
    138                        if [ $? -eq 0 -a "x$mntpt" = "x" ]; then
    139 		       		mntpt="/mnt/solaris$solaris"
    140                        fi
    141 
    142 #		       echo "$dnode -       /mnt/solaris$solaris ufs    -        no        -" >> /etc/vfstab
    143                        solaris=`/usr/bin/expr $solaris + 1`
    144 
    145                        if [ -z "$swp" ]
    146                        then
    147                            # Try to see whether a physical swap exists
    148                            slice=`/usr/sbin/prtvtoc -h $dnode | awk '{ if ($2 == "3") { print $1; } }'`
    149                            if [ "x$slice" != "x" ]
    150                            then
    151                                prefix=`echo $dnode |  /usr/bin/sed 's/s[0-9]*$//'`
    152                                swp="${prefix}s${slice}"
    153                                /usr/sbin/swap -a "$swp"
    154 	                       echo "Using physical swap on hdd ($swp)" > /dev/msglog
    155                            fi
    156                        fi
    157                fi
    158        fi
    159 done
    160 
    161 # Turn on I/O tracing if requested and possible
    162 trace=`prtconf -v /devices|sed -n '/trace/{;n;p;}'|cut -f 2 -d\'`
    163 if [ "$trace" = "on" ]; then
    164         if [ -n "$mntpt" ]; then
    165                 outputfile="${mntpt}/traceout"
    166                 echo "Enabling I/O Tracing ..." > /dev/console
    167                 /opt/DTT/Bin/iosnoop -Deg > "$outputfile" 2> /dev/console &
    168                 # Wait for iosnoop to actually initialize
    169                 sleep 10
    170         else
    171                 echo "Unable to enable I/O Tracing" > /dev/console
    172                 echo "Must have a mountable Solaris root slice on harddisk" > /d
    173 ev/console
    174                 echo "to hold trace output" > /dev/console
    175         fi
    176 fi
    177 	
    178 exit $SMF_EXIT_OK
    179