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]
23 # Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright 2015 Nexenta Systems, Inc. All rights reserved.
27 # Make sure that the libraries essential to this stage of booting can be found.
28 LD_LIBRARY_PATH
=/lib
; export LD_LIBRARY_PATH
30 .
/lib
/svc
/share
/smf_include.sh
31 .
/lib
/svc
/share
/fs_include.sh
34 # Most of the operations in this script are only necessary in the global
35 # zone but due to the way initialization scripts like this are packaged,
36 # it needs to currently exist for all zones.
38 if smf_is_nonglobalzone
; then
43 # Root is already mounted (by the kernel), but still needs to be
44 # checked, possibly remounted and entered into mnttab. First
45 # mount /usr if it is a separate file system. If the file system
46 # type is something other than zfs, mount it read-only. This must
47 # be done first to allow utilities such as fsck and setmnt to
48 # reside on /usr minimizing the space required by the root file
51 readvfstab
"/usr" < $vfstab
52 if [ -n "$mountp" ]; then
53 if [ "$fstype" = zfs
]; then
54 mountfs
- /usr
$fstype $mntopts - ||
exit $SMF_EXIT_ERR_FATAL
57 # Must use -o largefiles here to ensure the
58 # read-only mount does not fail as a result of
59 # having a large file present on /usr. This gives
60 # fsck a chance to fix up the largefiles flag
61 # before we remount /usr read-write.
63 if [ "x$mntopts" = x-
]; then
64 mntopts
='ro,largefiles'
66 checkopt largefiles
$mntopts
67 if [ "x$option" != xlargefiles
]; then
68 mntopts
="largefiles,$mntopts"
72 if [ "x$option" != xro
]; then
77 # Requesting logging on a read-only mount
78 # causes errors to be displayed, so remove
79 # "logging" from the list of options for now.
80 # The read-write mount performed later will
81 # specify the logging option if appropriate.
84 checkopt logging
$mntopts
85 if [ "x$option" = xlogging
]; then
90 mountfs
-O /usr
$fstype $mntopts - ||
exit $SMF_EXIT_ERR_FATAL
95 # if we are booted from zfs, the /usr mount probably won't be a
96 # legacy mount. Use the standard zfs mount command instead.
98 readmnttab
"/" < /etc
/mnttab
99 if [ "$fstype" = zfs
]; then
100 mountp
=`/sbin/zfs get -H -o value mountpoint $special/usr 2>/dev/null`
102 # if mountp = /usr, there is a non-legacy mount of /usr
103 # in the boot environment being booted.
105 if [ "x$mountp" = "x/usr" ] ; then
106 /sbin
/zfs mount
$special/usr
107 if [ $?
!= 0 ] ; then
108 msg
='zfs-mount failed'
110 echo "$SMF_FMRI:" $msg >/dev
/msglog
111 exit $SMF_EXIT_ERR_FATAL
117 # Also mount /boot now so that things like keymap.sh can access
118 # boot properties through eeprom. Readonly isn't required because
119 # /boot (and other pcfs filesystems) aren't fsck'ed at boot yet.
120 # Also, we don't account for caching /boot as it must be on a local
121 # disk. So what's in vfstab is fine as it stands; just look to see
122 # if it's there and avoid the mount if not.
124 readvfstab
"/boot" < $vfstab
126 if [ -n "$mountp" ]; then
127 mountfs
- /boot
$fstype $mntopts - ||
exit $SMF_EXIT_ERR_FATAL
131 # Update kernel driver.conf cache with any additional driver.conf
132 # files found on /usr, and device permissions from /etc/minor_perm.
134 /usr
/sbin
/devfsadm
-I -P