Mercurial > illumos > illumos-gate
changeset 10189:526ecf94a610
6861117 /kernel/drv/fcoe has incorrect dependency on drv/mac; should be misc/mac
6856975 Remove of fcoeconfig in Nevada 118 makes boot fail after upgrade
6857651 SUNWfcprtr doesn't delete services and associated files when package is removed
6858593 system/fcoe_target should be disabled by default
author | duo liu - Sun Microsystems - Beijing China <Duo.Liu@Sun.COM> |
---|---|
date | Tue, 28 Jul 2009 15:58:21 +0800 |
parents | f6fea79fdd1c |
children | 2e3297e2c8e7 |
files | usr/src/cmd/fcoesvc/fcoe_target.xml usr/src/pkgdefs/SUNWfcprtr/Makefile usr/src/pkgdefs/SUNWfcprtr/preinstall usr/src/pkgdefs/SUNWfcprtr/preremove usr/src/pkgdefs/SUNWfcprtr/prototype_com usr/src/uts/intel/fcoe/Makefile usr/src/uts/sparc/fcoe/Makefile |
diffstat | 7 files changed, 232 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/fcoesvc/fcoe_target.xml Tue Jul 28 09:41:22 2009 +0200 +++ b/usr/src/cmd/fcoesvc/fcoe_target.xml Tue Jul 28 15:58:21 2009 +0800 @@ -39,7 +39,7 @@ type='service' version='1'> - <create_default_instance enabled='true' /> + <create_default_instance enabled='false' /> <single_instance/>
--- a/usr/src/pkgdefs/SUNWfcprtr/Makefile Tue Jul 28 09:41:22 2009 +0200 +++ b/usr/src/pkgdefs/SUNWfcprtr/Makefile Tue Jul 28 15:58:21 2009 +0800 @@ -20,7 +20,7 @@ # # -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # @@ -30,7 +30,7 @@ .KEEP_STATE: -all: $(FILES) depend preremove +all: $(FILES) depend preremove preinstall install: all pkg
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/pkgdefs/SUNWfcprtr/preinstall Tue Jul 28 15:58:21 2009 +0800 @@ -0,0 +1,193 @@ +#!/bin/sh +# +# 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 +# or http://www.opensolaris.org/os/licensing. +# 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 2009 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# + +PATH="/usr/bin:/usr/sbin:${PATH}"; export PATH +MFSTSCAN=/lib/svc/bin/mfstscan +SVCCFG=/usr/sbin/svccfg +SVCADM=/usr/sbin/svcadm +SVCPROP=/usr/bin/svcprop + +STOP_DELAY=60 + +MANIFEST=/var/svc/manifest/network/fcoe_config.xml +MANIFEST_DEATH=/etc/svc/fcoe_config.xml.death +SVCINST=svc:/network/fcoe_config:default +DEATHROW_FILE=/etc/svc/deathrow +FCPRTRPKG=SUNWfcprtr + +# +# Helper function. Delete the manifest hash value. +# + +svc_delhash() +{ + $SVCCFG delhash -d $MANIFEST >/dev/null 2>&1 + if [ "$?" != "0" ];then + # this Solaris release doesn't have delhash command + pg_name=`$MFSTSCAN -t $MANIFEST` + if $SVCPROP -q -p $pg_name smf/manifest; then + $SVCCFG -s smf/manifest delpg $pg_name + fi + fi +} + +# +# Helper function. Handle services deathrow file. +# +svc_deathrow() +{ + DEATHROW_FILE=${PKG_INSTALL_ROOT}/etc/svc/deathrow + MANIFEST_FILE=${PKG_INSTALL_ROOT}${MANIFEST} + MANIFEST_FILE_DEATH=${PKG_INSTALL_ROOT}${MANIFEST_DEATH} + + ENTITIES=`SVCCFG_NOVALIDATE=1 $SVCCFG inventory ${MANIFEST_FILE}` + for fmri in $ENTITIES; do + # add to service deathrow file + echo ${fmri} ${MANIFEST_DEATH} ${FCPRTRPKG} >> ${DEATHROW_FILE} + done + mv ${MANIFEST_FILE} ${MANIFEST_FILE_DEATH} +} + +# +# Helper function. To hard code a deathrow file. +# +svc_deathrow_hardcode() +{ + DEATHROW_FILE=${PKG_INSTALL_ROOT}/etc/svc/deathrow + + echo "svc:/network/fcoe_config:default ${MANIFEST_DEATH} ${FCPRTRPKG}" >> ${DEATHROW_FILE} + echo "svc:/network/fcoe_config ${MANIFEST_DEATH} ${FCPRTRPKG}" >> ${DEATHROW_FILE} +} + +# +# Helper function. Wait the service to be disabled. +# +wait_disable() { + while [ ${nsec:=0} -lt $STOP_DELAY ]; do + state=`$SVCPROP -p restarter/state $SVCINST` + if [ "$state" = "disabled" -o "$state" = "maintenance" ]; then + nstate=`$SVCPROP -p restarter/next_state $SVCINST` + if [ "$nstate" = "none" ]; then + return 0 + fi + fi + /usr/bin/sleep 1 + nsec=`expr ${nsec} + 1` + done + return 1 +} + +if [ ! -f ${PKG_INSTALL_ROOT}${MANIFEST} ]; then + # + # Manifest file may get deleted before the running of this script + # e.g., during upgrade + # + svc_deathrow_hardcode + exit 0 +fi + +old_fmri=no + +ENTITIES=`$SVCCFG inventory ${PKG_INSTALL_ROOT}${MANIFEST}` +for fmri in $ENTITIES; do + if [ "$fmri" = "$SVCINST" ]; then + old_fmri=yes + fi +done + +if [ "$old_fmri" = "no" ]; then + # nothing to do as there is no old fmri + exit 0 +fi + +# +# To remove the old fmri +# +if [ -r /etc/svc/volatile/repository_door ]; then + smf_alive=yes +else + smf_alive=no +fi + +if [ "$PKG_INSTALL_ROOT" != "" -a "$PKG_INSTALL_ROOT" != "/" ]; then + smf_alive=no +fi + +if [ "$smf_alive" = "no" ]; then + svc_deathrow +else + ENTITIES=`$SVCCFG inventory $MANIFEST` + for fmri in $ENTITIES; do + # If this fmri refers to an instance, or a service + $SVCPROP -p restarter/state $fmri >/dev/null 2>/dev/null + if [ $? -eq 1 ]; then + # a service + $SVCCFG delete $fmri 2>/dev/null + continue + fi + + # + # Disable the instance + # + $SVCADM disable $fmri 2>/dev/null + if [ $? -eq 0 ]; then + wait_disable + if [ $? -eq 0 ]; then + #disabled + $SVCCFG delete -f $fmri 2>/dev/null + continue + fi + fi + + # + # Forcily removal + # + ctid=`$SVCPROP -p restarter/contract $fmri 2>/dev/null` + tctid=`$SVCPROP -p restarter/transient_contract $fmri 2>/dev/null` + + $SVCCFG delete -f $fmri + + # + # Kill remaining processes. + # + if [ -n "${tctid}" -a "${ctid}" -gt 1 ]; then + # kill the stopper + /usr/bin/pkill -9 -c $tctid + fi + if [ -n "${ctid}" -a "{ctid}" -gt 1 ]; then + # kill remaining processes + /usr/bin/pkill -9 -c $ctid + fi + done + # + # Delete manifest hash value + # + svc_delhash + # + # Nail it down + # + svc_deathrow +fi
--- a/usr/src/pkgdefs/SUNWfcprtr/preremove Tue Jul 28 09:41:22 2009 +0200 +++ b/usr/src/pkgdefs/SUNWfcprtr/preremove Tue Jul 28 15:58:21 2009 +0800 @@ -25,9 +25,35 @@ # # -PATH="/usr/bin:/usr/sbin:${PATH}"; export PATH +exitcode=0 + +disable_service() +{ + # + # Confirm service is installed, otherwise exit. + # + /usr/bin/svcprop -q ${SERVICE} + if [ $? -ne 0 ]; then + return + fi + + SVCPROP=`svcprop -c -p general/enabled ${SERVICE}` -SERVICE="svc:/network/npiv_config:default" + # + # Check to see if the service is running and if so disable it. + # + if [ "${SVCPROP}" = "true" ]; then + svcadm disable ${SERVICE} + if [ $? -ne 0 ]; then + echo "\n$0 Disabling of ${SERVICE} failed!\n" >&2 + exitcode = 1 + return + fi + svcadm refresh ${SERVICE} + fi +} + +PATH="/usr/bin:/usr/sbin:${PATH}"; export PATH # # The following case implies that the installation was not on the root disk @@ -39,43 +65,10 @@ exit 0 fi -# -# Confirm service is installed, otherwise exit. -# -/usr/bin/svcprop -q ${SERVICE} || exit 0 - -SVCPROP=`svcprop -p general/enabled ${SERVICE}` - -# -# Check to see if the service is running and if so disable it. -# -if [ "${SVCPROP}" = "true" ]; then - svcadm disable ${SERVICE} - if [ $? -ne 0 ]; then - echo "\n$0 Disabling of ${SERVICE} failed!\n" >&2 - exit 1 - fi - svcadm refresh ${SERVICE} -fi +SERVICE="svc:/network/npiv_config:default" +disable_service -SERVICE="svc:/network/fcoe_config:default" - -# -# Confirm service is installed, otherwise exit. -# -/usr/bin/svcprop -q ${SERVICE} || exit 0 - -SVCPROP=`svcprop -p general/enabled ${SERVICE}` +SERVICE="svc:/system/fcoe_target:default" +disable_service -# -# Check to see if the service is running and if so disable it. -# -if [ "${SVCPROP}" = "true" ]; then - svcadm disable ${SERVICE} - if [ $? -ne 0 ]; then - echo "\n$0 Disabling of ${SERVICE} failed!\n" >&2 - exit 1 - fi - svcadm refresh ${SERVICE} -fi -exit 0 +exit $exitcode
--- a/usr/src/pkgdefs/SUNWfcprtr/prototype_com Tue Jul 28 09:41:22 2009 +0200 +++ b/usr/src/pkgdefs/SUNWfcprtr/prototype_com Tue Jul 28 15:58:21 2009 +0800 @@ -37,6 +37,7 @@ i pkginfo i copyright i depend +i preinstall i preremove i i.manifest i r.manifest
--- a/usr/src/uts/intel/fcoe/Makefile Tue Jul 28 09:41:22 2009 +0200 +++ b/usr/src/uts/intel/fcoe/Makefile Tue Jul 28 15:58:21 2009 +0800 @@ -55,7 +55,7 @@ # Overrides and depends_on # MODSTUBS_DIR = $(OBJS_DIR) -LDFLAGS += -dy -Ndrv/mac +LDFLAGS += -dy -Nmisc/mac INC_PATH += -I$(UTSBASE)/common/io/fcoe #
--- a/usr/src/uts/sparc/fcoe/Makefile Tue Jul 28 09:41:22 2009 +0200 +++ b/usr/src/uts/sparc/fcoe/Makefile Tue Jul 28 15:58:21 2009 +0800 @@ -55,7 +55,7 @@ # Overrides and depends_on # MODSTUBS_DIR = $(OBJS_DIR) -LDFLAGS += -dy -Ndrv/mac +LDFLAGS += -dy -Nmisc/mac INC_PATH += -I$(UTSBASE)/common/io/fcoe #