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 (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# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T. 27# All rights reserved. 28# 29# 30# ident "%Z%%M% %I% %E% SMI" 31 32. /lib/svc/share/smf_include.sh 33. /lib/svc/share/fs_include.sh 34 35# Mount other file systems to be available in single user mode. 36# Currently, these are /var, /var/adm, /var/run and /tmp. A change 37# here will require a modification to the following programs (and 38# documentation): /sbin/mountall, /sbin/umountall, and 39# /lib/svc/bin/svc.startd. 40 41rootiszfs=0 42readmnttab / < /etc/mnttab 43if [ "$fstype" = zfs ] ; then 44 rootiszfs=1 45 be=$special 46fi 47 48for fs in /var /var/adm /tmp; do 49 readvfstab $fs < $vfstab 50 if [ -n "$mountp" ]; then 51 mounted $mountp $mntopts $fstype < /etc/mnttab && continue 52 checkfs $fsckdev $fstype $mountp || exit $SMF_EXIT_ERR_FATAL 53 mountfs -O $mountp $fstype $mntopts - || 54 exit $SMF_EXIT_ERR_FATAL 55 continue 56 fi 57 if [ "$rootiszfs" = 1 ]; then 58 mountpt=`zfs get -H -o value mountpoint $be$fs 2>/dev/null` 59 if [ $? = 0 ] ; then 60 if [ "x$mountpt" = "x$fs" ] ; then 61 /sbin/zfs mount -O $be$fs 62 fi 63 fi 64 fi 65done 66 67mounted /var/run - tmpfs < /etc/mnttab 68if [ $? != 0 ] ; then 69 mountfs -O /var/run tmpfs - swap || exit $SMF_EXIT_ERR_FATAL 70fi 71 72if [ "$rootiszfs" = 1 ] ; then 73 /sbin/zfs list -rH -o mountpoint -s mountpoint -t filesystem $be | \ 74 while read mountp ; do 75 if [ "x$mountp" != "x" -a "$mountp" != "legacy" ] ; then 76 mounted $mountp - zfs < /etc/mnttab && continue 77 /sbin/zfs mount $be$mountp 78 fi 79 done 80fi 81 82exit $SMF_EXIT_OK 83