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 (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
24 #
25
26 . /lib/svc/share/fs_include.sh
27 . /lib/svc/share/net_include.sh
28
29 # Make sure that the essential libraries can be found.
30 LD_LIBRARY_PATH=/lib; export LD_LIBRARY_PATH
31 STMSBOOTUTIL=/lib/mpxio/stmsboot_util
32 SAVEDIR=/etc/mpxio
33 BOOTDEVICES=$SAVEDIR/boot-devices
34 RECOVERFILE=$SAVEDIR/recover_instructions
35 DEVFSADM=/usr/sbin/devfsadm
36 DUMPADM=/usr/sbin/dumpadm
37 METADEVADM=/usr/sbin/metadevadm
38 ISROOTDEV=""
39 ISROOTDEVPATH=""
40 usrmounted=0
41 UNAME=/usr/bin/uname
42 ECHO=/usr/bin/echo
43 CAT=/usr/bin/cat
156 #
157 # mount /usr read only
158 #
159 mpxio_mount_usr()
160 {
161 exec < $vfstab; readvfstab "/usr"
162 ret_val=0
163 if [ -n "$mountp" ]; then
164 case "$special" in
165 /dev/md/*)
166 new_special=$special
167 ;;
168 /dev/vx/*)
169 new_special=$special
170 ;;
171 *)
172 new_special=`$STMSBOOTUTIL -m $special`
173 ;;
174 esac
175
176 if [ "$fstype" = "cachefs" ]; then
177 # Mount read-only without the cache.
178 case "$mntopts" in
179 *backfstype=nfs*)
180 cfsbacktype=nfs
181 ;;
182 *backfstype=hsfs*)
183 cfsbacktype=hsfs
184 ;;
185 *)
186 cecho 'stmsboot: invalid vfstab entry for /usr'
187 cfsbacktype=nfs
188 ;;
189 esac
190 # see the comment below for /dev/null
191 $MOUNT -m -F $cfsbacktype -o ro $new_special $mountp \
192 >/dev/null 2>&1
193 ret_val=$?
194 else
195 #
196 # Must use -o largefiles here to ensure the read-only
197 # mount does not fail as a result of having a large
198 # file present on /usr.
199 #
200 if [ "$mntopts" = "-" ]; then
201 mntopts='ro,largefiles'
202 else
203 checkopt largefiles $mntopts
204 if [ "$option" != "largefiles" ]; then
205 mntopts="largefiles,$mntopts"
206 fi
207
208 checkopt ro $mntopts
209 if [ "$option" != "ro" ]; then
210 mntopts="ro,$mntopts"
211 fi
212
213 # Requesting logging on a read-only mount
214 # causes errors to be displayed, so remove
215 # "logging" from the list of options.
216 checkopt logging $mntopts
217 if [ "$option" = "logging" ]; then
218 mntopts="$otherops"
219 fi
220 fi
221
222 # In case of a manual restart of the service, mount
223 # will emit messages if /usr is already mounted.
224 # So redirect the output to /dev/null.
225 $MOUNT -m -F $fstype -o $mntopts $new_special /usr \
226 >/dev/null 2>&1
227 ret_val=$?
228 fi
229 if [ $ret_val -eq 0 ]; then
230 usrmounted=1
231 fi
232 fi
233
234 return $ret_val
235 }
236
237 # update system dump configuration
238 update_dumpconf()
239 {
240 # Disable device-in-use checking (done in libdiskmgt).
241 # Without disabling this check, the configuration of dump device
242 # would fail as the device-in-use code incorrectly concludes that
243 # the device is in use and hence prevents configuration of the dump
244 # device.
245 NOINUSE_CHECK=1
246 export NOINUSE_CHECK
247
248 DUMPISZFS=`$AWK -F"=" '/DUMPADM_DEVICE/ {print $2}' /etc/dumpadm.conf|$EGREP zvol`
|
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 (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
24 # Copyright 2015 Nexenta Systems, Inc. All rights reserved.
25 #
26
27 . /lib/svc/share/fs_include.sh
28 . /lib/svc/share/net_include.sh
29
30 # Make sure that the essential libraries can be found.
31 LD_LIBRARY_PATH=/lib; export LD_LIBRARY_PATH
32 STMSBOOTUTIL=/lib/mpxio/stmsboot_util
33 SAVEDIR=/etc/mpxio
34 BOOTDEVICES=$SAVEDIR/boot-devices
35 RECOVERFILE=$SAVEDIR/recover_instructions
36 DEVFSADM=/usr/sbin/devfsadm
37 DUMPADM=/usr/sbin/dumpadm
38 METADEVADM=/usr/sbin/metadevadm
39 ISROOTDEV=""
40 ISROOTDEVPATH=""
41 usrmounted=0
42 UNAME=/usr/bin/uname
43 ECHO=/usr/bin/echo
44 CAT=/usr/bin/cat
157 #
158 # mount /usr read only
159 #
160 mpxio_mount_usr()
161 {
162 exec < $vfstab; readvfstab "/usr"
163 ret_val=0
164 if [ -n "$mountp" ]; then
165 case "$special" in
166 /dev/md/*)
167 new_special=$special
168 ;;
169 /dev/vx/*)
170 new_special=$special
171 ;;
172 *)
173 new_special=`$STMSBOOTUTIL -m $special`
174 ;;
175 esac
176
177 #
178 # Must use -o largefiles here to ensure the read-only
179 # mount does not fail as a result of having a large
180 # file present on /usr.
181 #
182 if [ "$mntopts" = "-" ]; then
183 mntopts='ro,largefiles'
184 else
185 checkopt largefiles $mntopts
186 if [ "$option" != "largefiles" ]; then
187 mntopts="largefiles,$mntopts"
188 fi
189
190 checkopt ro $mntopts
191 if [ "$option" != "ro" ]; then
192 mntopts="ro,$mntopts"
193 fi
194
195 # Requesting logging on a read-only mount
196 # causes errors to be displayed, so remove
197 # "logging" from the list of options.
198 checkopt logging $mntopts
199 if [ "$option" = "logging" ]; then
200 mntopts="$otherops"
201 fi
202 fi
203
204 # In case of a manual restart of the service, mount
205 # will emit messages if /usr is already mounted.
206 # So redirect the output to /dev/null.
207 $MOUNT -m -F $fstype -o $mntopts $new_special /usr \
208 >/dev/null 2>&1
209 ret_val=$?
210 if [ $ret_val -eq 0 ]; then
211 usrmounted=1
212 fi
213 fi
214
215 return $ret_val
216 }
217
218 # update system dump configuration
219 update_dumpconf()
220 {
221 # Disable device-in-use checking (done in libdiskmgt).
222 # Without disabling this check, the configuration of dump device
223 # would fail as the device-in-use code incorrectly concludes that
224 # the device is in use and hence prevents configuration of the dump
225 # device.
226 NOINUSE_CHECK=1
227 export NOINUSE_CHECK
228
229 DUMPISZFS=`$AWK -F"=" '/DUMPADM_DEVICE/ {print $2}' /etc/dumpadm.conf|$EGREP zvol`
|