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]
24 # Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
25 # Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
26 # All rights reserved.
27 # Copyright 2016 Nexenta Systems, Inc.
30 .
/lib
/svc
/share
/smf_include.sh
31 .
/lib
/svc
/share
/fs_include.sh
33 UPDATEFILE
=/etc
/svc
/volatile
/boot_archive_needs_update
36 # Once root is read/write we can enable the dedicated dumpdevice if it exists
37 # locally. This is an optimization as svc-dumpadm will attempt do this later.
41 [ -r /etc
/dumpadm.conf
] && .
/etc
/dumpadm.conf
43 readswapdev
$DUMPADM_DEVICE < $vfstab
46 # Make sure that the dump save area has been configured before
47 # proceeding. If the variable has not been defined or does not exist
48 # then bail out early. This will prevent us from configuring a
49 # dump save area before a hostname has been configured (i.e after
50 # sys-unconfig has been invoked).
52 [ -z "$DUMPADM_SAVDIR" ] && return
55 # If we have a dedicated dump device, then go ahead and configure it.
57 if [ "x$special" != "x$DUMPADM_DEVICE" ]; then
58 if [ -x /usr
/sbin
/dumpadm
-a -b $DUMPADM_DEVICE ]; then
59 /usr
/sbin
/dumpadm
-u ||
exit $SMF_EXIT_ERR_CONFIG
65 # Write a unique id into this kernel image; this will be included
66 # in the dump header and panicbuf of any crashdump of this image.
68 if [ -x /usr
/sbin
/dumpadm
]; then
73 # get the fstype of root
74 readmnttab
/ </etc
/mnttab
75 if [ "$fstype" = zfs
] ; then
86 # Check and remount the / (root) file system.
87 # For NFS mounts, force the llock option on.
89 if smf_is_globalzone
&& [ $rootiszfs = 0 ]; then
90 readvfstab
/ < $vfstab
91 checkfs
$fsckdev $fstype $mountp ||
exit $SMF_EXIT_ERR_FATAL
92 checkopt
"llock" $mntopts
95 [ -n "$otherops" ] && mntopts
="${mntopts},${otherops}"
96 [ "$fstype" = nfs
] && mntopts
="${mntopts},llock"
98 mountfs
-m $mountp $fstype $mntopts - ||
exit $SMF_EXIT_ERR_FATAL
102 # Check and remount the /usr file system (formerly mounted read-only).
103 # Unless root is zfs, in which case we've already mounted /usr read-write
105 if [ "$rootiszfs" = 0 ] ; then
106 readvfstab
/usr
< $vfstab
107 if [ "$mountp" ]; then
109 if [ "x$option" != xro
]; then
110 checkfs
$fsckdev $fstype $mountp ||
111 exit $SMF_EXIT_ERR_FATAL
112 if [ "x$mntopts" != x-
]; then
113 mntopts
="remount,$mntopts"
118 mountfs
- /usr
$fstype $mntopts - ||
119 exit $SMF_EXIT_ERR_FATAL
125 # Check and mount the /usr/platform file system. This should only be
126 # present when a SunOS 5.5 (Solaris 2.5) or greater client is being
127 # administered by a SunOS 5.4 or less host.
129 readvfstab
/usr
/platform
< $vfstab
130 if [ "$mountp" ]; then
131 checkfs
$fsckdev $fstype $mountp ||
exit $SMF_EXIT_ERR_FATAL
132 mountfs
- $mountp $fstype $mntopts - ||
exit $SMF_EXIT_ERR_FATAL
136 # Mount the fd file systems if mount point exists.
138 readvfstab
/dev
/fd
< $vfstab
139 if [ "$mountp" -a -d /dev
/fd
]; then
140 mountfs
- /dev
/fd
- - - ||
exit $SMF_EXIT_ERR_FATAL
143 if [ -f "${UPDATEFILE}" ]; then
144 /usr
/sbin
/bootadm update-archive
147 cecho
"WARNING: Automatic update of the boot archive failed."
148 cecho
"Update the archives using 'bootadm update-archive'"
149 cecho
"command and then reboot the system from the same device that"
150 cecho
"was previously booted."
152 exit $SMF_EXIT_ERR_FATAL
155 bootcmd
=`/usr/sbin/eeprom bootcmd | /usr/bin/sed -e 's#bootcmd=##g'`
156 if [ `uname -p` = "i386" ]; then
157 /usr
/sbin
/reboot
-f dryrun
159 /usr
/sbin
/reboot
-f -- "$bootcmd"
162 boot_prop
=`/usr/sbin/svccfg -s svc:/system/boot-config:default listprop config/auto-reboot-safe | \
163 /usr/bin/nawk '{ print $3}'`
164 if [ "$boot_prop" != "true" ]; then
166 cecho
"WARNING: Reboot required."
167 cecho
"The system has updated the cache of files (boot archive) that is used"
168 cecho
"during the early boot sequence. To avoid booting and running the system"
169 cecho
"with the previously out-of-sync version of these files, reboot the"
170 cecho
"system from the same device that was previously booted."
172 exit $SMF_EXIT_ERR_FATAL
178 /usr
/sbin
/reboot
-- "$bootcmd"