postinstall revision 8d483882aa3390058094b043f3d62187b5d1de03
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# CDDL HEADER START
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# The contents of this file are subject to the terms of the
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# Common Development and Distribution License (the "License").
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# You may not use this file except in compliance with the License.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# See the License for the specific language governing permissions
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# and limitations under the License.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# When distributing Covered Code, include this CDDL HEADER in each
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# If applicable, add the following below this CDDL HEADER, with the
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# fields enclosed by brackets "[]" replaced with your own identifying
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# information: Portions Copyright [yyyy] [name of copyright owner]
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# CDDL HEADER END
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# Use is subject to license terms.
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# ident "%Z%%M% %I% %E% SMI"
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. MaskeyBOOTENVRC_BAK=${NVSATA_TMP}/bootenv.rc.${BAK}
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. MaskeyPOWER_CONF_BAK=${NVSATA_TMP}/power.conf.${BAK}
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. MaskeyUPGRADE_LOG=${ROOT}/var/sadm/system/logs/upgrade_log
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. MaskeyLIVEUPGRADE_TMP_LOG=$TMP/.luupgrade.pfinstall.log.*
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. MaskeyDRIVER_ALIASES='"pci10de,37f" "pci10de,55" "pci10de,54"'
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. MaskeyENUMERATE_RESERVED=${ETC_DEV_DIR}/reserved_devnames
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey# get_devinfo_prop(file, prop)
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# <prtconf.out> file that has output from 'prtconf -vp' command
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# <prop> name of the property OR "ALL" for all properties
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# parse the output of prtconf command and print the value of
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# of the specified property or all if <prop> is "ALL" in
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck# the format "<name>=<value>".
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck if (match(prop,"ALL"))
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck check_all=1;
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck check_all=0;
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck if (!match($1, "name="))
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck if (!check_all) {
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck pname = sprintf("name=\047%s\047", prop);
d71dbb732372504daff1f1783bc0d8864ce9bd50jbeck if (!match($1, pname))
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey gsub("\047", "", $1);
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey name = substr($1, index($1,"=")+1);
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey if (match($2, "type=boolean")) {
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey } else if (match($2, "type=int") || match($2, "type=byte")) {
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey cnt = split(substr($0,index($0, "=")+1), words, ".");
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey for (i = 1; i <= cnt; i++) {
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey w = "0x" skipzeros(words[i]);
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey value = value " ";
6ba597c56d749c61b4f783157f63196d7b2445f0Anurag S. Maskey value = value w;
# device (i.e /devices path without '/devices' prefix) passed as
# e.g: get_properties "/pci@0,0/pci-ide@1f,2"
if [ -f ${DEV_PROPS} ]
if [ $? -eq 0 ]
if [ $? -eq 0 ]
rm -f ${PRTCONF_OUT}
# to nv_sata style in the file /boot/solaris/bootenv.rc for normal upgrade.
if [ $? -eq 1 ]
$CP ${BOOTENVRC} ${BOOTENVRC_BAK}
if [ $? -ne 0 ]
${RM} -rf ${NVSATA_TMP}
for pair in ${DRIVER_ALIASES}
if [ ${new_path} = ${mapped_path} ]
if [ ! -f ${NVSATA_TMP}/bootenv.rc ]
>> ${NVSATA_TMP}/bootenv.rc
if [ -f ${NVSATA_TMP}/bootenv.rc ]
${CP} ${NVSATA_TMP}/bootenv.rc ${BOOTENVRC}
if [ $? -ne 0 ]
${RM} -rf ${NVSATA_TMP}
# to nv_sata style in the file /boot/solaris/bootenv.rc for live upgrade.
if [ $? -eq 1 ]
$CP ${BOOTENVRC} ${BOOTENVRC_BAK}
if [ $? -ne 0 ]
${RM} -rf ${NVSATA_TMP}
for pair in ${DRIVER_ALIASES}
${dr_device_id} ]
if [ ! -f ${NVSATA_TMP}/bootenv.rc ]
echo ${mapped_bootpath_line} >> ${NVSATA_TMP}/bootenv.rc
for pair in ${DRIVER_ALIASES}
if [ $? -eq 0 ]
if [ ! -f ${NVSATA_TMP}/bootenv.rc ]
echo ${mapped_bootpath_line} >> \
if [ -f ${NVSATA_TMP}/bootenv.rc ]
${CP} ${NVSATA_TMP}/bootenv.rc ${BOOTENVRC}
if [ $? -ne 0 ]
${RM} -rf ${NVSATA_TMP}
if [ $? -eq 1 ]
${CP} ${SYSTEM} ${SYSTEM_BAK}
if [ $? -ne 0 ]
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
${RM} -rf ${NVSATA_TMP}
get_properties ${ar}
for pair in ${DRIVER_ALIASES}
${device_id} = ${dr_device_id} ]
get_properties ${ar}
for pair in ${DRIVER_ALIASES}
if [ $? -eq 0 ]
if [ -f ${NVSATA_TMP}/system ]
${CP} ${NVSATA_TMP}/system ${SYSTEM}
if [ $? -ne 0 ]
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
${RM} -rf ${NVSATA_TMP}
if [ $? -eq 1 ]
${CP} ${SYSTEM} ${SYSTEM_BAK}
if [ $? -ne 0 ]
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
${RM} -rf ${NVSATA_TMP}
for pair in ${DRIVER_ALIASES}
if [ $? -eq 0 ]
if [ -f ${NVSATA_TMP}/system ]
${CP} ${NVSATA_TMP}/system ${SYSTEM}
if [ $? -ne 0 ]
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
${RM} -rf ${NVSATA_TMP}
if [ $? -ne 0 ]
$CP ${POWER_CONF} ${POWER_CONF_BAK}
if [ $? -ne 0 ]
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
$CP ${SYSTEM_BAK} ${SYSTEM}
$RM -rf ${NVSATA_TMP}
>> ${NVSATA_TMP}/power.conf
${POWER_CONF} | while read l
for i in $l
tp=$i
if [ $? -eq 0 ]
for pair in ${DRIVER_ALIASES}
${device_id} = ${dr_device_id} ]
echo ${new_entry} >> ${NVSATA_TMP}/mapped_power.conf
echo ${new_entry} >> ${NVSATA_TMP}/power.conf
for i in $l
tp=$i
if [ $? -eq 0 ]
for pair in ${DRIVER_ALIASES}
if [ ${np} = ${mapped_path} ]
tp=${mapped_path}
echo ${new_entry} >> ${NVSATA_TMP}/mapped_power.conf
echo ${new_entry} >> ${NVSATA_TMP}/power.conf
if [ -f ${NVSATA_TMP}/mapped_power.conf ]
$CAT ${NVSATA_TMP}/mapped_power.conf >> ${NVSATA_TMP}/power.conf
$CP ${NVSATA_TMP}/power.conf ${POWER_CONF}
if [ $? -ne 0 ]
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
$CP ${SYSTEM_BAK} ${SYSTEM}
$RM -rf ${NVSATA_TMP}
if [ $? -ne 0 ]
$CP ${POWER_CONF} ${POWER_CONF_BAK}
if [ $? -ne 0 ]
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
$CP ${SYSTEM_BAK} ${SYSTEM}
$RM -rf ${NVSATA_TMP}
>> ${NVSATA_TMP}/power.conf
for i in $l
tp=$i
if [ $? -eq 0 ]
for pair in ${DRIVER_ALIASES}
if [ ${np} = ${mapped_path} ]
tp=${mapped_path}
echo ${new_entry} >> ${NVSATA_TMP}/mapped_power.conf
echo ${new_entry} >> ${NVSATA_TMP}/power.conf
if [ -f ${NVSATA_TMP}/mapped_power.conf ]
$CAT ${NVSATA_TMP}/mapped_power.conf >> ${NVSATA_TMP}/power.conf
$CP ${NVSATA_TMP}/power.conf ${POWER_CONF}
if [ $? -ne 0 ]
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
$CP ${SYSTEM_BAK} ${SYSTEM}
$RM -rf ${NVSATA_TMP}
for pair in ${DRIVER_ALIASES}
for pair in ${DRIVER_ALIASES}
if [ ${new_path} = ${mapped_new_path} ]
${MV} ${logical_disk} ${logical_disk}.${BAK}
if [ $? -ne 0 ]
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
$CP ${SYSTEM_BAK} ${SYSTEM}
$CP ${POWER_CONF_BAK} ${POWER_CONF}
${RM} -rf ${NVSATA_TMP}
${LN} -s ${mapped_new_path} ${logical_disk}
if [ $? -ne 0 ]
${MV} ${logical_disk}.${BAK} ${logical_disk}
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
$CP ${SYSTEM_BAK} ${SYSTEM}
$CP ${POWER_CONF_BAK} ${POWER_CONF}
${RM} -rf ${NVSATA_TMP}
$GREP ${c_number} ${ENUMERATE_RESERVED} >/dev/null
if [ $? -ne 0 ]
echo ${c_number} >> ${ENUMERATE_RESERVED}
cd ../rdsk
${MV} ${logical_disk} ${logical_disk}.${BAK}
if [ $? -ne 0 ]
${RM} ../dsk/${logical_disk}
${MV} ../dsk/${logical_disk}.${BAK} \
../dsk/${logical_disk}
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
$CP ${SYSTEM_BAK} ${SYSTEM}
$CP ${POWER_CONF_BAK} ${POWER_CONF}
${RM} -rf ${NVSATA_TMP}
${LN} -s ${mapped_new_path} ${logical_disk}
if [ $? -ne 0 ]
${MV} ${logical_disk}.${BAK} ${logical_disk}
${RM} ../dsk/${logical_disk}
${MV} ../dsk/${logical_disk}.${BAK} \
../dsk/${logical_disk}
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
$CP ${SYSTEM_BAK} ${SYSTEM}
$CP ${POWER_CONF_BAK} ${POWER_CONF}
${RM} -rf ${NVSATA_TMP}
if [ $? -eq 0 ]
$RM ${DEVLINK_DB}
for pair in ${DRIVER_ALIASES}
if [ ${new_path} = ${mapped_new_path} ]
${MV} ${logical_disk} ${logical_disk}.${BAK}
if [ $? -ne 0 ]
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
$CP ${SYSTEM_BAK} ${SYSTEM}
$CP ${POWER_CONF_BAK} ${POWER_CONF}
${RM} -rf ${NVSATA_TMP}
${LN} -s ${mapped_new_path} ${logical_disk}
if [ $? -ne 0 ]
${MV} ${logical_disk}.${BAK} ${logical_disk}
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
$CP ${SYSTEM_BAK} ${SYSTEM}
$CP ${POWER_CONF_BAK} ${POWER_CONF}
${RM} -rf ${NVSATA_TMP}
$GREP ${c_number} ${ENUMERATE_RESERVED} >/dev/null
if [ $? -ne 0 ]
echo ${c_number} >> ${ENUMERATE_RESERVED}
cd ../rdsk
${MV} ${logical_disk} ${logical_disk}.${BAK}
if [ $? -ne 0 ]
${RM} ../dsk/${logical_disk}
${MV} ../dsk/${logical_disk}.${BAK} \
../dsk/${logical_disk}
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
$CP ${SYSTEM_BAK} ${SYSTEM}
$CP ${POWER_CONF_BAK} ${POWER_CONF}
${RM} -rf ${NVSATA_TMP}
${LN} -s ${mapped_new_path} ${logical_disk}
if [ $? -ne 0 ]
${MV} ${logical_disk}.${BAK} ${logical_disk}
${RM} ../dsk/${logical_disk}
${MV} ../dsk/${logical_disk}.${BAK} \
../dsk/${logical_disk}
$CP ${BOOTENVRC_BAK} ${BOOTENVRC}
$CP ${SYSTEM_BAK} ${SYSTEM}
$CP ${POWER_CONF_BAK} ${POWER_CONF}
${RM} -rf ${NVSATA_TMP}
if [ $? -eq 0 ]
$RM ${DEVLINK_DB}
${RM} -rf ${NVSATA_TMP}
${RM} -f ${logical_disk}.${BAK}
cd ../rdsk
${RM} -f ${logical_disk}.${BAK}
# This function will check if the module has an entry in etc/name_to_major
BASEDIR=/
OPTIND=1
while getopts i:b:m:c:N opt
N ) NO_CMD=1;;
i ) ADD_ALIAS=1
alias=$OPTARG
m ) ADD_MINOR=1
c) ADD_CLASS=1
drvname=$1
eval $cmd
if [ $ADD_ALIAS = 1 ]
if [ $? -ne 0 ]
if [ $ADD_CLASS = 1 ]
if [ $? -ne 0 ]
if [ $ADD_MINOR = 1 ]
if [ $? -ne 0 ]
echo $minorentry >> ${ROOT}/etc/minor_perm
if [ ! -d ${NVSATA_TMP} ]
if [ -f ${UPGRADE_LOG} ]
if [ -f ${LIVEUPGRADE_TMP_LOG} ]