xref: /onnv-gate/usr/src/cmd/svc/milestone/fs-minimal (revision 11115:bcfb2bb98fca)
10Sstevel@tonic-gate#!/sbin/sh
20Sstevel@tonic-gate#
30Sstevel@tonic-gate# CDDL HEADER START
40Sstevel@tonic-gate#
50Sstevel@tonic-gate# The contents of this file are subject to the terms of the
66168Shs24103# Common Development and Distribution License (the "License").
76168Shs24103# You may not use this file except in compliance with the License.
80Sstevel@tonic-gate#
90Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate# See the License for the specific language governing permissions
120Sstevel@tonic-gate# and limitations under the License.
130Sstevel@tonic-gate#
140Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate#
200Sstevel@tonic-gate# CDDL HEADER END
210Sstevel@tonic-gate#
220Sstevel@tonic-gate#
23*11115SNobutomo.Nakano@Sun.COM# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
240Sstevel@tonic-gate# Use is subject to license terms.
250Sstevel@tonic-gate#
260Sstevel@tonic-gate# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
270Sstevel@tonic-gate# All rights reserved.
280Sstevel@tonic-gate#
290Sstevel@tonic-gate#
300Sstevel@tonic-gate
310Sstevel@tonic-gate. /lib/svc/share/smf_include.sh
320Sstevel@tonic-gate. /lib/svc/share/fs_include.sh
330Sstevel@tonic-gate
340Sstevel@tonic-gate# Mount other file systems to be available in single user mode.
350Sstevel@tonic-gate# Currently, these are /var, /var/adm, /var/run and /tmp.  A change
360Sstevel@tonic-gate# here will require a modification to the following programs (and
370Sstevel@tonic-gate# documentation): /sbin/mountall, /sbin/umountall, and
380Sstevel@tonic-gate# /lib/svc/bin/svc.startd.
390Sstevel@tonic-gate
406168Shs24103rootiszfs=0
416168Shs24103readmnttab / < /etc/mnttab
426168Shs24103if [ "$fstype" = zfs ] ; then
436168Shs24103	rootiszfs=1
446168Shs24103	be=$special
456168Shs24103fi
466168Shs24103
470Sstevel@tonic-gatefor fs in /var /var/adm /tmp; do
480Sstevel@tonic-gate	readvfstab $fs < $vfstab
490Sstevel@tonic-gate	if [ -n "$mountp" ]; then
500Sstevel@tonic-gate		mounted $mountp $mntopts $fstype < /etc/mnttab && continue
510Sstevel@tonic-gate		checkfs $fsckdev $fstype $mountp || exit $SMF_EXIT_ERR_FATAL
520Sstevel@tonic-gate		mountfs -O $mountp $fstype $mntopts - ||
530Sstevel@tonic-gate		    exit $SMF_EXIT_ERR_FATAL
546168Shs24103		continue
556168Shs24103	fi
566168Shs24103	if [ "$rootiszfs" = 1 ]; then
576168Shs24103		mountpt=`zfs get -H -o value mountpoint $be$fs 2>/dev/null`
586168Shs24103		if [ $? = 0 ] ; then
596168Shs24103			if [ "x$mountpt" = "x$fs" ] ; then
606423Sgw25295				/sbin/zfs mount -O $be$fs
616168Shs24103			fi
626168Shs24103		fi
630Sstevel@tonic-gate	fi
640Sstevel@tonic-gatedone
650Sstevel@tonic-gate
666168Shs24103mounted /var/run - tmpfs < /etc/mnttab
676168Shs24103if [ $? != 0 ] ; then
686168Shs24103	mountfs -O /var/run tmpfs - swap || exit $SMF_EXIT_ERR_FATAL
696168Shs24103fi
706168Shs24103
71*11115SNobutomo.Nakano@Sun.COMif [ ! -f /var/run/tzsync ] ; then
72*11115SNobutomo.Nakano@Sun.COM	/sbin/tzreload -I
73*11115SNobutomo.Nakano@Sun.COMfi
74*11115SNobutomo.Nakano@Sun.COM
756168Shs24103if [ "$rootiszfs" = 1 ] ; then
766612Sgw25295	/sbin/zfs list -rH -o mountpoint -s mountpoint -t filesystem $be | \
776168Shs24103	    while read mountp ; do
786168Shs24103		if [ "x$mountp" != "x" -a "$mountp" != "legacy" ] ; then
796168Shs24103			mounted $mountp - zfs < /etc/mnttab  && continue
806168Shs24103			/sbin/zfs mount $be$mountp
816168Shs24103		fi
826168Shs24103	done
836168Shs24103fi
840Sstevel@tonic-gate
850Sstevel@tonic-gateexit $SMF_EXIT_OK
86