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