|
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 "@(#)fs-usr 1.12 08/03/04 SMI" |
|
31 |
|
32 . /lib/svc/share/smf_include.sh |
|
33 . /lib/svc/share/fs_include.sh |
|
34 |
|
35 # |
|
36 # Add physical swap. |
|
37 # |
|
38 /sbin/swapadd -1 |
|
39 |
|
40 rootiszfs=0 |
|
41 # get the fstype of root |
|
42 readmnttab / </etc/mnttab |
|
43 if [ "$fstype" = zfs ] ; then |
|
44 rootiszfs=1 |
|
45 fi |
|
46 |
|
47 # |
|
48 # Check and remount the / (root) file system. |
|
49 # For NFS mounts, force the llock option on. |
|
50 # |
|
51 if smf_is_globalzone; then |
|
52 readvfstab / < $vfstab |
|
53 checkfs $fsckdev $fstype $mountp || exit $SMF_EXIT_ERR_FATAL |
|
54 checkopt "llock" $mntopts |
|
55 mntopts='remount' |
|
56 |
|
57 [ -n "$otherops" ] && mntopts="${mntopts},${otherops}" |
|
58 [ "$fstype" = nfs ] && mntopts="${mntopts},llock" |
|
59 |
|
60 # if root dev is a read-only metadevice then fail |
|
61 case $special in |
|
62 /dev/md/dsk/*) |
|
63 dd if=/dev/null of=$special count=0 >/dev/null 2>&1 || |
|
64 exit $SMF_EXIT_ERR_FATAL |
|
65 ;; |
|
66 esac |
|
67 |
|
68 mountfs -m $mountp $fstype $mntopts - || exit $SMF_EXIT_ERR_FATAL |
|
69 fi |
|
70 |
|
71 # |
|
72 # Check and remount the /usr file system (formerly mounted read-only). |
|
73 # Unless root is zfs, in which case we've already mounted /usr read-write |
|
74 # |
|
75 if [ "$rootiszfs" = 0 ] ; then |
|
76 readvfstab /usr < $vfstab |
|
77 if [ "$mountp" ]; then |
|
78 if [ "$fstype" = cachefs ]; then |
|
79 mountfs -O $mountp cachefs $mntopts $special || |
|
80 exit $SMF_EXIT_ERR_FATAL |
|
81 else |
|
82 checkopt ro $mntopts |
|
83 if [ "x$option" != xro ]; then |
|
84 checkfs $fsckdev $fstype $mountp || |
|
85 exit $SMF_EXIT_ERR_FATAL |
|
86 if [ "x$mntopts" != x- ]; then |
|
87 mntopts="remount,$mntopts" |
|
88 else |
|
89 mntopts="remount" |
|
90 fi |
|
91 |
|
92 # if usr dev is a read-only metadevice then fail |
|
93 case $special in |
|
94 /dev/md/dsk/*) |
|
95 dd if=/dev/null of=$special count=0 \ |
|
96 >/dev/null 2>&1 || exit $SMF_EXIT_ERR_FATAL |
|
97 ;; |
|
98 esac |
|
99 |
|
100 mountfs - /usr $fstype $mntopts - || |
|
101 exit $SMF_EXIT_ERR_FATAL |
|
102 fi |
|
103 fi |
|
104 fi |
|
105 fi |
|
106 |
|
107 # |
|
108 # Check and mount the /usr/platform file system. This should only be |
|
109 # present when a SunOS 5.5 (Solaris 2.5) or greater client is being |
|
110 # administered by a SunOS 5.4 or less host. |
|
111 # |
|
112 readvfstab /usr/platform < $vfstab |
|
113 if [ "$mountp" ]; then |
|
114 checkfs $fsckdev $fstype $mountp || exit $SMF_EXIT_ERR_FATAL |
|
115 mountfs - $mountp $fstype $mntopts - || exit $SMF_EXIT_ERR_FATAL |
|
116 fi |
|
117 |
|
118 # |
|
119 # Mount the fd file systems if mount point exists. |
|
120 # |
|
121 readvfstab /dev/fd < $vfstab |
|
122 if [ "$mountp" -a -d /dev/fd ]; then |
|
123 mountfs - /dev/fd - - - || exit $SMF_EXIT_ERR_FATAL |
|
124 fi |
|
125 |
|
126 exit $SMF_EXIT_OK |