17c478bd9Sstevel@tonic-gate#!/sbin/sh 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6a227b7f4Shs24103# Common Development and Distribution License (the "License"). 7a227b7f4Shs24103# You may not use this file except in compliance with the License. 87c478bd9Sstevel@tonic-gate# 97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate# and limitations under the License. 137c478bd9Sstevel@tonic-gate# 147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate# 207c478bd9Sstevel@tonic-gate# CDDL HEADER END 217c478bd9Sstevel@tonic-gate# 227c478bd9Sstevel@tonic-gate# 23a227b7f4Shs24103# Copyright 2008 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate# Use is subject to license terms. 257c478bd9Sstevel@tonic-gate# 267c478bd9Sstevel@tonic-gate# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T. 277c478bd9Sstevel@tonic-gate# All rights reserved. 287c478bd9Sstevel@tonic-gate# 297c478bd9Sstevel@tonic-gate# 307c478bd9Sstevel@tonic-gate# ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate. /lib/svc/share/smf_include.sh 337c478bd9Sstevel@tonic-gate. /lib/svc/share/fs_include.sh 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate# Mount other file systems to be available in single user mode. 367c478bd9Sstevel@tonic-gate# Currently, these are /var, /var/adm, /var/run and /tmp. A change 377c478bd9Sstevel@tonic-gate# here will require a modification to the following programs (and 387c478bd9Sstevel@tonic-gate# documentation): /sbin/mountall, /sbin/umountall, and 397c478bd9Sstevel@tonic-gate# /lib/svc/bin/svc.startd. 407c478bd9Sstevel@tonic-gate 41a227b7f4Shs24103rootiszfs=0 42a227b7f4Shs24103readmnttab / < /etc/mnttab 43a227b7f4Shs24103if [ "$fstype" = zfs ] ; then 44a227b7f4Shs24103 rootiszfs=1 45a227b7f4Shs24103 be=$special 46a227b7f4Shs24103fi 47a227b7f4Shs24103 487c478bd9Sstevel@tonic-gatefor fs in /var /var/adm /tmp; do 497c478bd9Sstevel@tonic-gate readvfstab $fs < $vfstab 507c478bd9Sstevel@tonic-gate if [ -n "$mountp" ]; then 517c478bd9Sstevel@tonic-gate mounted $mountp $mntopts $fstype < /etc/mnttab && continue 527c478bd9Sstevel@tonic-gate checkfs $fsckdev $fstype $mountp || exit $SMF_EXIT_ERR_FATAL 537c478bd9Sstevel@tonic-gate mountfs -O $mountp $fstype $mntopts - || 547c478bd9Sstevel@tonic-gate exit $SMF_EXIT_ERR_FATAL 55a227b7f4Shs24103 continue 56a227b7f4Shs24103 fi 57a227b7f4Shs24103 if [ "$rootiszfs" = 1 ]; then 58a227b7f4Shs24103 mountpt=`zfs get -H -o value mountpoint $be$fs 2>/dev/null` 59a227b7f4Shs24103 if [ $? = 0 ] ; then 60a227b7f4Shs24103 if [ "x$mountpt" = "x$fs" ] ; then 61*e7cbe64fSgw25295 /sbin/zfs mount -O $be$fs 62a227b7f4Shs24103 fi 63a227b7f4Shs24103 fi 647c478bd9Sstevel@tonic-gate fi 657c478bd9Sstevel@tonic-gatedone 667c478bd9Sstevel@tonic-gate 67a227b7f4Shs24103mounted /var/run - tmpfs < /etc/mnttab 68a227b7f4Shs24103if [ $? != 0 ] ; then 697c478bd9Sstevel@tonic-gate mountfs -O /var/run tmpfs - swap || exit $SMF_EXIT_ERR_FATAL 70a227b7f4Shs24103fi 71a227b7f4Shs24103 72a227b7f4Shs24103if [ "$rootiszfs" = 1 ] ; then 73a227b7f4Shs24103 /sbin/zfs list -rH -o mountpoint -s mountpoint $be | \ 74a227b7f4Shs24103 while read mountp ; do 75a227b7f4Shs24103 if [ "x$mountp" != "x" -a "$mountp" != "legacy" ] ; then 76a227b7f4Shs24103 mounted $mountp - zfs < /etc/mnttab && continue 77a227b7f4Shs24103 /sbin/zfs mount $be$mountp 78a227b7f4Shs24103 fi 79a227b7f4Shs24103 done 80a227b7f4Shs24103fi 817c478bd9Sstevel@tonic-gate 827c478bd9Sstevel@tonic-gateexit $SMF_EXIT_OK 83