treewide: replace /sbin/sh hashbangs with /bin/sh
[unleashed.git] / usr / src / cmd / svc / milestone / fs-minimal
blobccdc198f97cd990436eb6da77396b20e91fd7dcb
1 #!/bin/sh
3 # CDDL HEADER START
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.
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.
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]
20 # CDDL HEADER END
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
26 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
27 # All rights reserved.
31 . /lib/svc/share/smf_include.sh
32 . /lib/svc/share/fs_include.sh
34 # Mount other file systems to be available in single user mode.
35 # Currently, these are /var, /var/adm, /var/run and /tmp. A change
36 # here will require a modification to the following programs (and
37 # documentation): /sbin/mountall, /sbin/umountall, and
38 # /lib/svc/bin/svc.startd.
40 rootiszfs=0
41 readmnttab / < /etc/mnttab
42 if [ "$fstype" = zfs ] ; then
43 rootiszfs=1
44 be=$special
47 for fs in /var /var/adm /tmp; do
48 readvfstab $fs < $vfstab
49 if [ -n "$mountp" ]; then
50 mounted $mountp $mntopts $fstype < /etc/mnttab && continue
51 checkfs $fsckdev $fstype $mountp || exit $SMF_EXIT_ERR_FATAL
52 mountfs -O $mountp $fstype $mntopts - ||
53 exit $SMF_EXIT_ERR_FATAL
54 continue
56 if [ "$rootiszfs" = 1 ]; then
57 mountpt=`zfs get -H -o value mountpoint $be$fs 2>/dev/null`
58 if [ $? = 0 ] ; then
59 if [ "x$mountpt" = "x$fs" ] ; then
60 /sbin/zfs mount -O $be$fs
64 done
66 mounted /var/run - tmpfs < /etc/mnttab
67 if [ $? != 0 ] ; then
68 mountfs -O /var/run tmpfs - swap || exit $SMF_EXIT_ERR_FATAL
71 if [ ! -f /var/run/tzsync ] ; then
72 /sbin/tzreload -I
75 if [ "$rootiszfs" = 1 ] ; then
76 /sbin/zfs list -rH -o mountpoint -s mountpoint -t filesystem $be | \
77 while read mountp ; do
78 if [ "x$mountp" != "x" -a "$mountp" != "legacy" ] ; then
79 mounted $mountp - zfs < /etc/mnttab && continue
80 /sbin/zfs mount $be$mountp
82 done
85 exit $SMF_EXIT_OK