1*7c478bd9Sstevel@tonic-gate#!/sbin/sh 2*7c478bd9Sstevel@tonic-gate# 3*7c478bd9Sstevel@tonic-gate# CDDL HEADER START 4*7c478bd9Sstevel@tonic-gate# 5*7c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6*7c478bd9Sstevel@tonic-gate# Common Development and Distribution License, Version 1.0 only 7*7c478bd9Sstevel@tonic-gate# (the "License"). You may not use this file except in compliance 8*7c478bd9Sstevel@tonic-gate# with the License. 9*7c478bd9Sstevel@tonic-gate# 10*7c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11*7c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 12*7c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 13*7c478bd9Sstevel@tonic-gate# and limitations under the License. 14*7c478bd9Sstevel@tonic-gate# 15*7c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 16*7c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17*7c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 18*7c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 19*7c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 20*7c478bd9Sstevel@tonic-gate# 21*7c478bd9Sstevel@tonic-gate# CDDL HEADER END 22*7c478bd9Sstevel@tonic-gate# 23*7c478bd9Sstevel@tonic-gate# 24*7c478bd9Sstevel@tonic-gate# Copyright 2005 Sun Microsystems, Inc. All rights reserved. 25*7c478bd9Sstevel@tonic-gate# Use is subject to license terms. 26*7c478bd9Sstevel@tonic-gate# 27*7c478bd9Sstevel@tonic-gate# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T. 28*7c478bd9Sstevel@tonic-gate# All rights reserved. 29*7c478bd9Sstevel@tonic-gate# 30*7c478bd9Sstevel@tonic-gate# 31*7c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate. /lib/svc/share/smf_include.sh 34*7c478bd9Sstevel@tonic-gate. /lib/svc/share/fs_include.sh 35*7c478bd9Sstevel@tonic-gate 36*7c478bd9Sstevel@tonic-gate# 37*7c478bd9Sstevel@tonic-gate# Add physical swap. 38*7c478bd9Sstevel@tonic-gate# 39*7c478bd9Sstevel@tonic-gate/sbin/swapadd -1 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate# 42*7c478bd9Sstevel@tonic-gate# Check and remount the / (root) file system. 43*7c478bd9Sstevel@tonic-gate# For NFS mounts, force the llock option on. 44*7c478bd9Sstevel@tonic-gate# 45*7c478bd9Sstevel@tonic-gateif [ "${_INIT_ZONENAME:=`/sbin/zonename`}" = "global" ]; then 46*7c478bd9Sstevel@tonic-gate readvfstab / < $vfstab 47*7c478bd9Sstevel@tonic-gate checkfs $fsckdev $fstype $mountp || exit $SMF_EXIT_ERR_FATAL 48*7c478bd9Sstevel@tonic-gate checkopt "llock" $mntopts 49*7c478bd9Sstevel@tonic-gate mntopts='remount' 50*7c478bd9Sstevel@tonic-gate 51*7c478bd9Sstevel@tonic-gate [ -n "$otherops" ] && mntopts="${mntopts},${otherops}" 52*7c478bd9Sstevel@tonic-gate [ "$fstype" = nfs ] && mntopts="${mntopts},llock" 53*7c478bd9Sstevel@tonic-gate 54*7c478bd9Sstevel@tonic-gate # if root dev is a read-only metadevice then fail 55*7c478bd9Sstevel@tonic-gate case $special in 56*7c478bd9Sstevel@tonic-gate /dev/md/dsk/*) 57*7c478bd9Sstevel@tonic-gate dd if=/dev/null of=$special count=0 >/dev/null 2>&1 || 58*7c478bd9Sstevel@tonic-gate exit $SMF_EXIT_ERR_FATAL 59*7c478bd9Sstevel@tonic-gate ;; 60*7c478bd9Sstevel@tonic-gate esac 61*7c478bd9Sstevel@tonic-gate 62*7c478bd9Sstevel@tonic-gate mountfs -m $mountp $fstype $mntopts - || exit $SMF_EXIT_ERR_FATAL 63*7c478bd9Sstevel@tonic-gatefi 64*7c478bd9Sstevel@tonic-gate 65*7c478bd9Sstevel@tonic-gate# 66*7c478bd9Sstevel@tonic-gate# Check and remount the /usr file system (formerly mounted read-only). 67*7c478bd9Sstevel@tonic-gate# 68*7c478bd9Sstevel@tonic-gatereadvfstab /usr < $vfstab 69*7c478bd9Sstevel@tonic-gateif [ "$mountp" ]; then 70*7c478bd9Sstevel@tonic-gate if [ "$fstype" = cachefs ]; then 71*7c478bd9Sstevel@tonic-gate mountfs -O $mountp cachefs $mntopts $special || 72*7c478bd9Sstevel@tonic-gate exit $SMF_EXIT_ERR_FATAL 73*7c478bd9Sstevel@tonic-gate else 74*7c478bd9Sstevel@tonic-gate checkopt ro $mntopts 75*7c478bd9Sstevel@tonic-gate if [ "x$option" != xro ]; then 76*7c478bd9Sstevel@tonic-gate checkfs $fsckdev $fstype $mountp || 77*7c478bd9Sstevel@tonic-gate exit $SMF_EXIT_ERR_FATAL 78*7c478bd9Sstevel@tonic-gate if [ "x$mntopts" != x- ]; then 79*7c478bd9Sstevel@tonic-gate mntopts="remount,$mntopts" 80*7c478bd9Sstevel@tonic-gate else 81*7c478bd9Sstevel@tonic-gate mntopts="remount" 82*7c478bd9Sstevel@tonic-gate fi 83*7c478bd9Sstevel@tonic-gate 84*7c478bd9Sstevel@tonic-gate # if usr dev is a read-only metadevice then fail 85*7c478bd9Sstevel@tonic-gate case $special in 86*7c478bd9Sstevel@tonic-gate /dev/md/dsk/*) 87*7c478bd9Sstevel@tonic-gate dd if=/dev/null of=$special count=0 \ 88*7c478bd9Sstevel@tonic-gate >/dev/null 2>&1 || exit $SMF_EXIT_ERR_FATAL 89*7c478bd9Sstevel@tonic-gate ;; 90*7c478bd9Sstevel@tonic-gate esac 91*7c478bd9Sstevel@tonic-gate 92*7c478bd9Sstevel@tonic-gate mountfs - /usr $fstype $mntopts - || 93*7c478bd9Sstevel@tonic-gate exit $SMF_EXIT_ERR_FATAL 94*7c478bd9Sstevel@tonic-gate fi 95*7c478bd9Sstevel@tonic-gate fi 96*7c478bd9Sstevel@tonic-gatefi 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate# 99*7c478bd9Sstevel@tonic-gate# Check and mount the /usr/platform file system. This should only be 100*7c478bd9Sstevel@tonic-gate# present when a SunOS 5.5 (Solaris 2.5) or greater client is being 101*7c478bd9Sstevel@tonic-gate# administered by a SunOS 5.4 or less host. 102*7c478bd9Sstevel@tonic-gate# 103*7c478bd9Sstevel@tonic-gatereadvfstab /usr/platform < $vfstab 104*7c478bd9Sstevel@tonic-gateif [ "$mountp" ]; then 105*7c478bd9Sstevel@tonic-gate checkfs $fsckdev $fstype $mountp || exit $SMF_EXIT_ERR_FATAL 106*7c478bd9Sstevel@tonic-gate mountfs - $mountp $fstype $mntopts - || exit $SMF_EXIT_ERR_FATAL 107*7c478bd9Sstevel@tonic-gatefi 108*7c478bd9Sstevel@tonic-gate 109*7c478bd9Sstevel@tonic-gate# 110*7c478bd9Sstevel@tonic-gate# Mount the fd file systems if mount point exists. 111*7c478bd9Sstevel@tonic-gate# 112*7c478bd9Sstevel@tonic-gatereadvfstab /dev/fd < $vfstab 113*7c478bd9Sstevel@tonic-gateif [ "$mountp" -a -d /dev/fd ]; then 114*7c478bd9Sstevel@tonic-gate mountfs - /dev/fd - - - || exit $SMF_EXIT_ERR_FATAL 115*7c478bd9Sstevel@tonic-gatefi 116*7c478bd9Sstevel@tonic-gate 117*7c478bd9Sstevel@tonic-gate# Clean up existing /etc/dfs/sharetab as there are no shared file systems 118*7c478bd9Sstevel@tonic-gate# at this point. This also takes care of a corrupt sharetab. 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gateif [ -f /etc/dfs/sharetab ]; then 121*7c478bd9Sstevel@tonic-gate > /etc/dfs/sharetab 122*7c478bd9Sstevel@tonic-gatefi 123*7c478bd9Sstevel@tonic-gate 124*7c478bd9Sstevel@tonic-gateexit $SMF_EXIT_OK 125