Print this page
6197 get rid of unused checks in fs-root and fs-usr boot scripts
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/cmd/svc/milestone/fs-root
+++ new/usr/src/cmd/svc/milestone/fs-root
1 1 #!/sbin/sh
2 2 #
3 3 # CDDL HEADER START
4 4 #
5 5 # The contents of this file are subject to the terms of the
6 6 # Common Development and Distribution License (the "License").
7 7 # You may not use this file except in compliance with the License.
8 8 #
9 9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 10 # or http://www.opensolaris.org/os/licensing.
11 11 # See the License for the specific language governing permissions
12 12 # and limitations under the License.
13 13 #
↓ open down ↓ |
13 lines elided |
↑ open up ↑ |
14 14 # When distributing Covered Code, include this CDDL HEADER in each
15 15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 16 # If applicable, add the following below this CDDL HEADER, with the
17 17 # fields enclosed by brackets "[]" replaced with your own identifying
18 18 # information: Portions Copyright [yyyy] [name of copyright owner]
19 19 #
20 20 # CDDL HEADER END
21 21 #
22 22 #
23 23 # Copyright (c) 1992, 2010, Oracle and/or its affiliates. All rights reserved.
24 +# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
24 25 #
25 26
26 27 # Make sure that the libraries essential to this stage of booting can be found.
27 28 LD_LIBRARY_PATH=/lib; export LD_LIBRARY_PATH
28 29
29 30 libc_mount() {
30 31 #
31 32 # If there is an optimized libc available in /usr that fits this
32 33 # processor, mount it on top of the base libc.
33 34 #
34 35 LIBC_MOE_32=`/usr/bin/moe -32 '/usr/lib/libc/$HWCAP'`
35 36 if [ -n "$LIBC_MOE_32" ]; then
36 37 /usr/sbin/mount | egrep -s "^/lib/libc.so.1 on "
37 38 if [ $? -ne 0 ]; then
38 39 /usr/sbin/mount -O -F lofs $LIBC_MOE_32 /lib/libc.so.1
39 40 fi
40 41 fi
41 42
42 43 ARCH64=`isainfo | awk '{print $1}'`
43 44 LIBC_MOE_64=`/usr/bin/moe -64 /usr/lib/$ARCH64/libc/'$HWCAP'`
44 45 if [ -n "$LIBC_MOE_64" ]; then
45 46 /usr/sbin/mount | egrep -s "^/lib/$ARCH64/libc.so.1 on "
46 47 if [ $? -ne 0 ]; then
47 48 /usr/sbin/mount -O -F lofs $LIBC_MOE_64 \
48 49 /lib/$ARCH64/libc.so.1
49 50 fi
50 51 fi
51 52 }
52 53
53 54 . /lib/svc/share/smf_include.sh
54 55 . /lib/svc/share/fs_include.sh
55 56
56 57 #
57 58 # Most of the operations in this script are only necessary in the global
58 59 # zone but due to the way initialization scripts like this are packaged,
59 60 # it needs to currently exist for all zones.
60 61 #
61 62 if smf_is_nonglobalzone; then
62 63 libc_mount
63 64 exit $SMF_EXIT_OK
64 65 fi
65 66
66 67 #
↓ open down ↓ |
33 lines elided |
↑ open up ↑ |
67 68 # Root is already mounted (by the kernel), but still needs to be
68 69 # checked, possibly remounted and entered into mnttab. First
69 70 # mount /usr if it is a separate file system. If the file system
70 71 # type is something other than zfs, mount it read-only. This must
71 72 # be done first to allow utilities such as fsck and setmnt to
72 73 # reside on /usr minimizing the space required by the root file
73 74 # system.
74 75 #
75 76 readvfstab "/usr" < $vfstab
76 77 if [ -n "$mountp" ]; then
77 - if [ "$fstype" = cachefs ]; then
78 - #
79 - # Mount without the cache initially. We'll enable it
80 - # later at remount time. This lets us avoid
81 - # teaching the statically linked mount program about
82 - # cachefs. Here we determine the backfstype.
83 - # This is not pretty, but we have no tools for parsing
84 - # the option string until we get /usr mounted...
85 - #
86 - case "$mntopts" in
87 - *backfstype=nfs*)
88 - cfsbacktype=nfs
89 - ;;
90 - *backfstype=hsfs*)
91 - cfsbacktype=hsfs
92 - ;;
93 - *)
94 - msg='invalid vfstab entry for /usr'
95 - echo $msg
96 - echo "$SMF_FMRI:" $msg >/dev/msglog
97 - cfsbacktype=nfs
98 - ;;
99 - esac
100 - mountfs - /usr $cfsbacktype ro $special ||
101 - exit $SMF_EXIT_ERR_FATAL
102 - elif [ "$fstype" = zfs ]; then
78 + if [ "$fstype" = zfs ]; then
103 79 mountfs - /usr $fstype $mntopts - || exit $SMF_EXIT_ERR_FATAL
104 80 else
105 81 #
106 82 # Must use -o largefiles here to ensure the
107 83 # read-only mount does not fail as a result of
108 84 # having a large file present on /usr. This gives
109 85 # fsck a chance to fix up the largefiles flag
110 86 # before we remount /usr read-write.
111 87 #
112 88 if [ "x$mntopts" = x- ]; then
113 89 mntopts='ro,largefiles'
114 90 else
115 91 checkopt largefiles $mntopts
116 92 if [ "x$option" != xlargefiles ]; then
117 93 mntopts="largefiles,$mntopts"
118 94 fi
119 95
120 96 checkopt ro $mntopts
121 97 if [ "x$option" != xro ]; then
122 98 mntopts="ro,$mntopts"
123 99 fi
124 100
125 101 #
126 102 # Requesting logging on a read-only mount
127 103 # causes errors to be displayed, so remove
128 104 # "logging" from the list of options for now.
129 105 # The read-write mount performed later will
130 106 # specify the logging option if appropriate.
131 107 #
132 108
133 109 checkopt logging $mntopts
134 110 if [ "x$option" = xlogging ]; then
135 111 mntopts="$otherops"
136 112 fi
137 113 fi
138 114
139 115 mountfs -O /usr $fstype $mntopts - || exit $SMF_EXIT_ERR_FATAL
140 116 fi
141 117 fi
142 118
143 119 #
144 120 # if we are booted from zfs, the /usr mount probably won't be a
145 121 # legacy mount. Use the standard zfs mount command instead.
146 122
147 123 readmnttab "/" < /etc/mnttab
148 124 if [ "$fstype" = zfs ]; then
149 125 mountp=`/sbin/zfs get -H -o value mountpoint $special/usr 2>/dev/null`
150 126 #
151 127 # if mountp = /usr, there is a non-legacy mount of /usr
152 128 # in the boot environment being booted.
153 129 #
154 130 if [ "x$mountp" = "x/usr" ] ; then
155 131 /sbin/zfs mount $special/usr
156 132 if [ $? != 0 ] ; then
157 133 msg='zfs-mount failed'
158 134 echo $msg
159 135 echo "$SMF_FMRI:" $msg >/dev/msglog
160 136 exit $SMF_EXIT_ERR_FATAL
161 137 fi
162 138 fi
163 139 fi
164 140
165 141 #
166 142 # Also mount /boot now so that things like keymap.sh can access
167 143 # boot properties through eeprom. Readonly isn't required because
168 144 # /boot (and other pcfs filesystems) aren't fsck'ed at boot yet.
169 145 # Also, we don't account for caching /boot as it must be on a local
170 146 # disk. So what's in vfstab is fine as it stands; just look to see
171 147 # if it's there and avoid the mount if not.
172 148 #
173 149 readvfstab "/boot" < $vfstab
174 150
175 151 if [ -n "$mountp" ]; then
176 152 mountfs - /boot $fstype $mntopts - || exit $SMF_EXIT_ERR_FATAL
177 153 fi
178 154
179 155 #
180 156 # Update kernel driver.conf cache with any additional driver.conf
181 157 # files found on /usr, and device permissions from /etc/minor_perm.
182 158 #
183 159 /usr/sbin/devfsadm -I -P
184 160
185 161 libc_mount
186 162
187 163 exit $SMF_EXIT_OK
↓ open down ↓ |
75 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX