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-usr
+++ new/usr/src/cmd/svc/milestone/fs-usr
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 #
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
↓ open down ↓ |
16 lines elided |
↑ open up ↑ |
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) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
24 24 #
25 25 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
26 26 # All rights reserved.
27 +# Copyright 2015 Nexenta Systems, Inc. All rights reserved.
27 28 #
28 -#
29 29 . /lib/svc/share/smf_include.sh
30 30 . /lib/svc/share/fs_include.sh
31 31
32 32 UPDATEFILE=/etc/svc/volatile/boot_archive_needs_update
33 33
34 34 #
35 35 # Once root is read/write we can enable the dedicated dumpdevice if it exists
36 36 # locally. This is an optimization as svc-dumpadm will attempt do this later.
37 37 #
38 38 dump_setup()
39 39 {
40 40 [ -r /etc/dumpadm.conf ] && . /etc/dumpadm.conf
41 41
42 42 readswapdev $DUMPADM_DEVICE < $vfstab
43 43
44 44 #
45 45 # Make sure that the dump save area has been configured before
46 46 # proceeding. If the variable has not been defined or does not exist
47 47 # then bail out early. This will prevent us from configuring a
48 48 # dump save area before a hostname has been configured (i.e after
49 49 # sys-unconfig has been invoked).
50 50 #
51 51 [ -z "$DUMPADM_SAVDIR" ] && return
52 52
53 53 #
54 54 # If we have a dedicated dump device, then go ahead and configure it.
55 55 #
56 56 if [ "x$special" != "x$DUMPADM_DEVICE" ]; then
57 57 if [ -x /usr/sbin/dumpadm -a -b $DUMPADM_DEVICE ]; then
58 58 /usr/sbin/dumpadm -u || exit $SMF_EXIT_ERR_CONFIG
59 59 fi
60 60 fi
61 61 }
62 62
63 63 #
64 64 # Write a unique id into this kernel image; this will be included
65 65 # in the dump header and panicbuf of any crashdump of this image.
66 66 #
67 67 if [ -x /usr/sbin/dumpadm ]; then
68 68 /usr/sbin/dumpadm -i
69 69 fi
70 70
71 71 rootiszfs=0
72 72 # get the fstype of root
73 73 readmnttab / </etc/mnttab
74 74 if [ "$fstype" = zfs ] ; then
75 75 rootiszfs=1
76 76 dump_setup
77 77 fi
78 78
79 79 #
80 80 # Add physical swap.
81 81 #
82 82 /sbin/swapadd -1
83 83
84 84 #
85 85 # Check and remount the / (root) file system.
86 86 # For NFS mounts, force the llock option on.
87 87 #
88 88 if smf_is_globalzone && [ $rootiszfs = 0 ]; then
89 89 readvfstab / < $vfstab
90 90 checkfs $fsckdev $fstype $mountp || exit $SMF_EXIT_ERR_FATAL
91 91 checkopt "llock" $mntopts
92 92 mntopts='remount'
93 93
94 94 [ -n "$otherops" ] && mntopts="${mntopts},${otherops}"
95 95 [ "$fstype" = nfs ] && mntopts="${mntopts},llock"
96 96
97 97 # if root dev is a read-only metadevice then fail
98 98 case $special in
99 99 /dev/md/dsk/*)
100 100 dd if=/dev/null of=$special count=0 >/dev/null 2>&1 ||
101 101 exit $SMF_EXIT_ERR_FATAL
102 102 ;;
103 103 esac
104 104
↓ open down ↓ |
66 lines elided |
↑ open up ↑ |
105 105 mountfs -m $mountp $fstype $mntopts - || exit $SMF_EXIT_ERR_FATAL
106 106 fi
107 107
108 108 #
109 109 # Check and remount the /usr file system (formerly mounted read-only).
110 110 # Unless root is zfs, in which case we've already mounted /usr read-write
111 111 #
112 112 if [ "$rootiszfs" = 0 ] ; then
113 113 readvfstab /usr < $vfstab
114 114 if [ "$mountp" ]; then
115 - if [ "$fstype" = cachefs ]; then
116 - mountfs -O $mountp cachefs $mntopts $special ||
115 + checkopt ro $mntopts
116 + if [ "x$option" != xro ]; then
117 + checkfs $fsckdev $fstype $mountp ||
117 118 exit $SMF_EXIT_ERR_FATAL
118 - else
119 - checkopt ro $mntopts
120 - if [ "x$option" != xro ]; then
121 - checkfs $fsckdev $fstype $mountp ||
122 - exit $SMF_EXIT_ERR_FATAL
123 - if [ "x$mntopts" != x- ]; then
124 - mntopts="remount,$mntopts"
125 - else
126 - mntopts="remount"
127 - fi
119 + if [ "x$mntopts" != x- ]; then
120 + mntopts="remount,$mntopts"
121 + else
122 + mntopts="remount"
123 + fi
128 124
129 - # if usr dev is a read-only metadevice then fail
130 - case $special in
131 - /dev/md/dsk/*)
132 - dd if=/dev/null of=$special count=0 \
133 - >/dev/null 2>&1 || exit $SMF_EXIT_ERR_FATAL
134 - ;;
135 - esac
125 + # if usr dev is a read-only metadevice then fail
126 + case $special in
127 + /dev/md/dsk/*)
128 + dd if=/dev/null of=$special count=0 \
129 + >/dev/null 2>&1 || exit $SMF_EXIT_ERR_FATAL
130 + ;;
131 + esac
136 132
137 - mountfs - /usr $fstype $mntopts - ||
138 - exit $SMF_EXIT_ERR_FATAL
139 - fi
133 + mountfs - /usr $fstype $mntopts - ||
134 + exit $SMF_EXIT_ERR_FATAL
140 135 fi
141 136 fi
142 137 fi
143 138
144 139 #
145 140 # Check and mount the /usr/platform file system. This should only be
146 141 # present when a SunOS 5.5 (Solaris 2.5) or greater client is being
147 142 # administered by a SunOS 5.4 or less host.
148 143 #
149 144 readvfstab /usr/platform < $vfstab
150 145 if [ "$mountp" ]; then
151 146 checkfs $fsckdev $fstype $mountp || exit $SMF_EXIT_ERR_FATAL
152 147 mountfs - $mountp $fstype $mntopts - || exit $SMF_EXIT_ERR_FATAL
153 148 fi
154 149
155 150 #
156 151 # Mount the fd file systems if mount point exists.
157 152 #
158 153 readvfstab /dev/fd < $vfstab
159 154 if [ "$mountp" -a -d /dev/fd ]; then
160 155 mountfs - /dev/fd - - - || exit $SMF_EXIT_ERR_FATAL
161 156 fi
162 157
163 158 if [ -f "${UPDATEFILE}" ]; then
164 159 /usr/sbin/bootadm update-archive
165 160 if [ $? != 0 ]; then
166 161 cecho ""
167 162 cecho "WARNING: Automatic update of the boot archive failed."
168 163 cecho "Update the archives using 'bootadm update-archive'"
169 164 cecho "command and then reboot the system from the same device that"
170 165 cecho "was previously booted."
171 166 cecho ""
172 167 exit $SMF_EXIT_ERR_FATAL
173 168 fi
174 169 rm -f $UPDATEFILE
175 170 bootcmd=`/usr/sbin/eeprom bootcmd | /usr/bin/sed -e 's#bootcmd=##g'`
176 171 if [ `uname -p` = "i386" ]; then
177 172 /usr/sbin/reboot -f dryrun
178 173 if [ $? = 0 ]; then
179 174 /usr/sbin/reboot -f -- "$bootcmd"
180 175 exit $SMF_EXIT_OK
181 176 fi
182 177 boot_prop=`/usr/sbin/svccfg -s svc:/system/boot-config:default listprop config/auto-reboot-safe | \
183 178 /usr/bin/nawk '{ print $3}'`
184 179 if [ "$boot_prop" != "true" ]; then
185 180 cecho ""
186 181 cecho "WARNING: Reboot required."
187 182 cecho "The system has updated the cache of files (boot archive) that is used"
188 183 cecho "during the early boot sequence. To avoid booting and running the system"
189 184 cecho "with the previously out-of-sync version of these files, reboot the"
190 185 cecho "system from the same device that was previously booted."
191 186 cecho ""
192 187 exit $SMF_EXIT_ERR_FATAL
193 188 else
194 189 /usr/sbin/reboot -p
195 190 exit $SMF_EXIT_OK
196 191 fi
197 192 fi
198 193 /usr/sbin/reboot -- "$bootcmd"
199 194 fi
200 195
201 196 exit $SMF_EXIT_OK
↓ open down ↓ |
52 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX