stmsboot.sh revision 5a4c37c9b23ecb4d64c8f198f2002aaae2f22e91
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#ident "%Z%%M% %I% %E% SMI"
export TEXTDOMAIN
if [ "x$MACH" = "xsparc" ]; then
CLIENT_TYPE_VHCI="/scsi_vhci.*/ssd@.*"
CLIENT_TYPE_PHCI="/fp@.*/ssd@.*"
else
CLIENT_TYPE_VHCI="/scsi_vhci.*/disk@.*"
CLIENT_TYPE_PHCI="/fp@.*/disk@.*"
fi
#
# Copy all entries (including comments) from source driver.conf to destination
# driver.conf except those entries which contain mpxio-disable property.
# Take into consideration entries that spawn more than one line.
#
# $1 source driver.conf file
# $2 destination driver.conf file
#
# Returns 0 on success, non zero on failure.
#
{
sed '
/^[ ]*#/{ p
d
}
s/[ ]*$//
/^$/{ p
d
}
/mpxio-disable[ ]*=.*;$/{ w '$3'
d
}
/;$/{ p
d
}
:rdnext
N
s/[ ]*$//
/[^;]$/b rdnext
/mpxio-disable[ ]*=/{ s/\n/ /g
w '$3'
d
}
' $1 > $2
return $?
}
#
# backup the last saved copy of the specified files.
# $* files to backup
#
{
do
fi
done
}
#
# build recover instructions
#
# $1 1 to include boot script in the instructions
# 0 otherwise
#
{
gettext "Instructions to recover your previous STMS configuration (if in case the system does not boot):\n\n" > $RECOVERFILE
gettext "\tUndo the modifications you made to STMS configuration.\n\tFor example undo any changes you made to " >> $RECOVERFILE
else
fi
if [ $1 -eq 1 ]; then
fi
fi
gettext "was your root device,\nbut it could be named differently after you boot net.\n" >> $RECOVERFILE
}
#
# during the next reboot. If the cmd is "enable" or "disable", copy
# $TMPFPCONF to $FPCONF.
#
# Returns 0 on success, 1 on failure.
#
{
gettext "WARNING: This operation will require a reboot.\nDo you want to continue ? [y/n] (default: y) "
read response
rm -f $TMPFPCONF
return 0
fi
rm -f $TMPFPCONF
#
# there is no need to update the system files in the following
# cases:
# - we are enabling mpxio and the system has no configured
# disks accessible by phci paths.
# - we are disabling mpxio and the system has no configured
# disks accessible by vhci paths.
#
else
fi
if [ $? -ne 0 ]; then
fi
fi
if [ $need_bootscript -eq 1 ]; then
#only update bootpath for x86.
fi
#
# Enable the mpxio-upgrade service, but don't run it now.
# The service will run during the next reboot and will do
# the actual job of modifying the system files.
#
svccfg -f - << EOF
select $STMSINSTANCE
setprop general/enabled = true
EOF
fi
gettext "The changes will come into effect after rebooting the system.\nReboot the system now ? [y/n] (default: y) "
read response
fi
return 0
}
#
# Enable or disable mpxio as specified by the cmd.
# Returns 0 on success, 1 on failure.
#
{
mpxiodisableno='mpxio-disable[ ]*=[ ]*"no"[ ]*;'
mpxiodisableyes='mpxio-disable[ ]*=[ ]*"yes"[ ]*;'
else
fi
if [ -s $TMPFPCONF_MPXIO_ENTRY ]; then
# fp.conf does have mpxiodisable entries
if [ $? -ne 0 ]; then
echo "$msg"
return 0
fi
# If mpxiodisable entries does not exist, always continue update
fi
else
return 1
fi
#Need to update bootpath on x86 if boot system from FC disk
#Only update bootpath before reboot when mpxio is enabled
#If mpxio is disabled currently, will update bootpath in mpxio-upgrade
if [ $? -ne 0 ]; then
rm -f $TMPFPCONF
return 1
fi
fi
return $?
}
setcmd()
{
cmd=$1
else
exit 2
fi
}
#Need to update bootpath on x86 if boot system from FC disk
#Only update bootpath here when mpxio is enabled
#If mpxio is disabled currently, will update bootpath in mpxio-upgrade
return 0
fi
return 1
fi
#only update bootpath for STMS path
echo $cur_bootpath|grep $CLIENT_TYPE_VHCI > /dev/null 2>&1
if [ $? -eq 1 ]; then
return 0
fi
if [ $? -ne 0 ]; then
new_bootpath=""
return 1
fi
}
# process options
while getopts eduLl: c
do
case $c in
exit 2;;
esac
done
exit 2
fi
set `id`
if [ "$1" != "uid=0(root)" ]; then
exit 1
fi
# just a sanity check
if [ ! -f $STMSBOOTUTIL -o ! -f $STMSMETHODSCRIPT ]; then
exit 1
fi
if [ $? -ne 0 ]; then
exit 1
fi
#
# The bootup script doesn't work on cache-only-clients as the script
# is executed before the plumbing for cachefs mounting of root is done.
#
gettext "This command option is not supported on systems with nfs or cachefs mounted root filesystem.\n" 1>&2
exit 1
fi
if [ -d $SAVEDIR ]; then
#
# keep a copy of the last saved files, useful for manual
# recovery in case of a problem.
#
if [ "x$MACH" = "xsparc" ]; then
else
fi
else
fi
fi
if [ "x$MACH" = "xi386" ]; then
# In this case we always change the bootpath to phci-based
# path first. bootpath will later be modified in mpxio-upgrade
# to the vhci-based path if mpxio is enabled on root.
if [ $? -ne 0 ]; then
return 1
fi
fi
else
fi
exit $?