#!/sbin/sh -
# @(#)src/cmd/vxvm/solaris/init.d/vxvm-startup2.sh	3.1.1.5 06/24/97 15:39:04 - 
#ident	"@(#)vxvm:src/cmd/vxvm/solaris/init.d/vxvm-startup2.sh	3.1.1.5"

# Copyright(C)1997 VERITAS Software Corporation.  ALL RIGHTS RESERVED.
# UNPUBLISHED -- RIGHTS RESERVED UNDER THE COPYRIGHT
# LAWS OF THE UNITED STATES.  USE OF A COPYRIGHT NOTICE
# IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
# OR DISCLOSURE.
# 
# THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND
# TRADE SECRETS OF VERITAS SOFTWARE.  USE, DISCLOSURE,
# OR REPRODUCTION IS PROHIBITED WITHOUT THE PRIOR
# EXPRESS WRITTEN PERMISSION OF VERITAS SOFTWARE.
# 
#               RESTRICTED RIGHTS LEGEND
# USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT IS
# SUBJECT TO RESTRICTIONS AS SET FORTH IN SUBPARAGRAPH
# (C) (1) (ii) OF THE RIGHTS IN TECHNICAL DATA AND
# COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013.
#               VERITAS SOFTWARE
# 1600 PLYMOUTH STREET, MOUNTAIN VIEW, CA 94043

# This startup script must be run AFTER /, /usr, and /var are mounted.
# This script starts some I/O daemons, rebuilds the /dev/vx/dsk and
# /dev/vx/rdsk directories, imports all disk groups, and starts all
# volumes that were not started earlier in the boot sequence.

# This startup script must be run before bcheckrc.  This starts all
# volumes without performing any recovery.  bcheckrc requires that
# the stand and var volumes be started, but we might as well start
# all of them now.

PATH=/usr/lib/vxvm/bin:/sbin:/usr/sbin:/usr/bin

# do not start if the upgrade_start script was run and the upgrade_finish
# has not be run yet, because /etc/vx/slib does not have right libraries
# till the upgrade_finish is run

if [ -f /VXVM2.5-UPGRADE/.start_runed ]
then
	exit 0
fi

# if the volume manager hasn't yet been initialized, don't bother
# starting vxconfigd.  The install-db file indicates that initialization
# has NOT yet happened.

if [ -f "/etc/vx/reconfig.d/state.d/install-db" ]
then
	exit 0
fi

egettxt "VxVM general startup..." vxvmshm:503

# start some I/O daemons, if there aren't any already running
case "`vxiod`" in
"0 "*) vxiod set 10;;
esac

if [ ! -x /sbin/vxconfigd ]; then
	egettxt \
	"vxvm: Volume configuration daemon is not executable
	No volumes started" \
	vxvmshm:574
	exit
fi

# enabled vxconfigd to force a rebuild of /dev/vx/dsk and /dev/vx/rdsk
# directories, and to import all disk groups.  If vxconfigd is not yet
# running, then run it.
vxdctl enable 2> /dev/null
if [ $? -eq 4 ]; then
	vxconfigd
fi

vxdctl initdmp 2> /dev/null

# Reattach drives that were inaccessible when vxconfigd first started, to
# handle loadable disk drivers.  Also, start volumes, but don't
# perform plex recovery.  Wait until we go multi-user to do that.
if [ "X`vxdctl mode 2> /dev/null`" = "Xmode: enabled" ]; then
	vxreattach
	vxrecover -n -s
else
	egettxt \
	"vxvm: Vold is not enabled for transactions
	No volumes started" \
	vxvmshm:573
	exit
fi
