components/ipmitool/test_ipmievd
author Petr Sumbera <petr.sumbera@oracle.com>
Tue, 22 May 2012 04:06:19 -0500
branchs11-sru
changeset 2280 1cd8b83ac351
parent 268 6518166b581c
permissions -rwxr-xr-x
7085706 update vim to 7.3.421 7129634 vim does not support ZFS ACLs so they are lost when editing files 7109350 gvim has 64-bit runpath
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
268
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     1
#!/bin/sh
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     2
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     3
# CDDL HEADER START
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     4
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     5
# The contents of this file are subject to the terms of the
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     6
# Common Development and Distribution License (the "License").
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     7
# You may not use this file except in compliance with the License.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     8
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     9
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    10
# or http://www.opensolaris.org/os/licensing.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    11
# See the License for the specific language governing permissions
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    12
# and limitations under the License.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    13
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    14
# When distributing Covered Code, include this CDDL HEADER in each
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    15
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    16
# If applicable, add the following below this CDDL HEADER, with the
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    17
# fields enclosed by brackets "[]" replaced with your own identifying
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    18
# information: Portions Copyright [yyyy] [name of copyright owner]
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    19
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    20
# CDDL HEADER END
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    21
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    22
# Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    23
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    24
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    25
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    26
# test_ipmievd		confirm basic ipmievd functionality works
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    27
#
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    28
# exercise syslog event reporting via event injection via ipmitool
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    29
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    30
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    31
cmd_name="`basename $0`"		# the name of this command
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    32
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    33
cmd_err="${cmd_name}: error:"		# the (fatal) error header
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    34
cmd_warn="${cmd_name}: warning:"	# the warning header
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    35
cmd_info="${cmd_name}: info:"		# the informational header
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    36
cmd_query="${cmd_name}: query:"		# the interrogative header
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    37
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    38
bin_path="/usr/sbin:/usr/lib"	# path(s) to needed binary executable(s)
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    39
proto_root=""			# path to proto root from build
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    40
state_fn="/tmp/$cnd_name.$$.db"	# state file for cleanup
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    41
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    42
# Design_Note: typically it takes about 4 seconds for an event to be syslogged,
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    43
#              let's allow at least 12 seconds for it to be syslogged.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    44
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    45
SYSLOG_DELAY_SEC=12	# max wait in sec for event to be syslogged
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    46
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    47
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    48
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    49
usage()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    50
{
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    51
    echo "usage: $cmd_name [-r <proto_root>]"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    52
    echo "       -r  path to proto root of recent build of tool+daemon"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    53
    echo "purpose: confirm basic ipmievd functionality works;"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    54
    echo "         this is NOT a comprehensive test"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    55
    echo "examples:"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    56
    echo "	$cmd_name -r \$CODEMGR_WS/proto/root_\`uname -p\`"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    57
    echo "caveats: installs and leaves installed new tool+daemon on error"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    58
} # usage()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    59
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    60
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    61
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    62
show_env()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    63
{
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    64
    echo "$cmd_info general environment:"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    65
    date ; id ; uname -a ; pwd ; echo "$PATH"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    66
    [ -r /etc/release ] && cat /etc/release
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    67
    [ -r /etc/motd ] && grep bfu /etc/motd
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    68
    ipmievd -V
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    69
    ipmitool -V
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    70
} # usage()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    71
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    72
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    73
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    74
enforce_i386()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    75
{
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    76
    proctype=`uname -p`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    77
    [ "$proctype" != "i386" ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    78
	echo "$cmd_err processor type $proctype != i386"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    79
	exit 1
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    80
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    81
} # enforce_i386()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    82
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    83
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    84
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    85
install_proto()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    86
{
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    87
    [ "$proto_root" = "" ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    88
	echo "$cmd_info skipping install of unset proto_root" ; return 0
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    89
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    90
    [ ! -r /usr/sbin/ipmitool.orig ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    91
	cp -p /usr/sbin/ipmitool /usr/sbin/ipmitool.orig
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    92
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    93
    [ ! -r /usr/lib/ipmievd.orig ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    94
	cp -p /usr/lib/ipmievd /usr/lib/ipmievd.orig
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    95
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    96
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    97
    # disable/kill ipmievd before overwriting binary
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    98
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    99
    sstate=`svcs | grep '/ipmievd:' | awk '{print $1}'`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   100
    echo "ipmievd_svc_state: $sstate" > $state_fn
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   101
    [ "$sstate" = "online" ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   102
	echo "$cmd_info disabling ipmievd service per proto_root"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   103
	svcadm disable -ts ipmievd
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   104
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   105
    pkill -x ipmievd	# may or may not have been running as a service
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   106
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   107
    echo "$cmd_info installing proto_root tool+daemon"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   108
    cp $proto_root/usr/sbin/ipmitool /usr/sbin/ipmitool
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   109
    cp $proto_root/usr/lib/ipmievd   /usr/lib/ipmievd
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   110
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   111
} # install_proto()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   112
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   113
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   114
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   115
uninstall_proto()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   116
{
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   117
    [ "$proto_root" = "" ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   118
	echo "$cmd_info skipping uninstall of unset proto_root" ; return 0
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   119
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   120
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   121
    # disable/kill ipmievd before overwriting binary
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   122
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   123
    sstate=`svcs | grep '/ipmievd:' | awk '{print $1}'`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   124
    [ "$sstate" = "online" ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   125
	echo "$cmd_info disabling ipmievd service per proto_root"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   126
	svcadm disable -ts ipmievd
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   127
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   128
    pkill -x ipmievd	# may or may not have been running as a service
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   129
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   130
    echo "$cmd_info uninstalling proto_root tool+daemon"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   131
    [ -r /usr/sbin/ipmitool.orig ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   132
	cp -p /usr/sbin/ipmitool.orig /usr/sbin/ipmitool
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   133
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   134
    [ -r /usr/lib/ipmievd.orig ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   135
	cp -p /usr/lib/ipmievd.orig /usr/lib/ipmievd
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   136
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   137
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   138
    # restore initial state of ipmievd svc if known
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   139
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   140
    [ ! -r $state_fn ] && return 0
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   141
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   142
    was_online=`grep -c "ipmievd_svc_state.*online" $state_fn`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   143
    [ $was_online -ne 0 ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   144
	echo "$cmd_info enabling ipmievd service per initial state"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   145
	svcadm enable -s ipmievd
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   146
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   147
} # uninstall_proto()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   148
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   149
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   150
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   151
test_opt_version()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   152
{
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   153
    tnm="version option"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   154
    ipmievd -V > ipmievd_V.out
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   155
    rc=$?
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   156
    [ $rc -ne 0 ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   157
	echo "$cmd_err $tnm failed with exit code $rc" ; exit $rc
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   158
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   159
    cnt=`grep -i -c 'version.*[0-9][0-9]*\.[0-9]' ipmievd_V.out`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   160
    [ $cnt -le 0 ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   161
	echo "$cmd_err $tnm output missing version" ; exit 1
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   162
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   163
    echo "$cmd_info $tnm passed"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   164
} # test_opt_version()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   165
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   166
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   167
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   168
test_opt_help()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   169
{
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   170
    tnm="help option"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   171
    ipmievd -h > ipmievd_h.out 2>&1
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   172
    rc=$?
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   173
    [ $rc -ne 0 ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   174
	echo "$cmd_err $tnm failed with exit code $rc" ; exit $rc
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   175
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   176
    cnt=`grep -i 'interface' ipmievd_h.out | grep -i -c 'bmc'`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   177
    [ $cnt -le 0 ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   178
	echo "$cmd_err $tnm output missing bmc interface" ; exit 1
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   179
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   180
    echo "$cmd_info $tnm passed"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   181
} # test_opt_help()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   182
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   183
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   184
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   185
test_svc_online()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   186
{
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   187
    tnm="service online check"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   188
    sstate=`svcs | grep '/ipmievd:' | awk '{print $1}'`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   189
    [ "$sstate" = "online" ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   190
	echo "$cmd_info disabling ipmievd service"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   191
	svcadm disable -ts ipmievd
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   192
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   193
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   194
    echo "$cmd_info enabling ipmievd service"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   195
    svcadm enable -ts ipmievd
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   196
    sstate=`svcs | grep '/ipmievd:' | awk '{print $1}'`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   197
    [ "$sstate" != "online" ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   198
	echo "$cmd_err $tnm ipmievd service state $sstate != online" ; exit 1
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   199
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   200
    echo "$cmd_info $tnm passed"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   201
} # test_svc_online()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   202
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   203
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   204
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   205
test_syslog_init()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   206
{
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   207
    tnm="syslog initial entries"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   208
    # Reading|Waiting events below are generated by bringing svc online;
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   209
    # wait some for them to be syslogged.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   210
    echo "$cmd_info may wait $SYSLOG_DELAY_SEC sec per expected syslog entry"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   211
    sleep $SYSLOG_DELAY_SEC
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   212
    cnt1=`grep -i -c 'ipmievd.*Reading' /var/adm/messages`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   213
    cnt2=`grep -i -c 'ipmievd.*Waiting' /var/adm/messages`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   214
    grep ipmievd /var/adm/messages > ipmievd.syslog_init.out
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   215
    [ $cnt1 -lt 1 ] || [ $cnt2 -lt 1 ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   216
	echo "$cmd_err $tnm ipmievd too few initial syslog entries" ; exit 1
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   217
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   218
    echo "$cmd_info $tnm passed"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   219
} # test_syslog_init()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   220
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   221
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   222
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   223
test_syslog_event()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   224
{
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   225
    num="$1"	# event number being tested
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   226
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   227
    tnm="syslog event $num entry"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   228
    now=`date | awk '{print $2 " " $3}'`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   229
    cnt1=`grep -i -c "$now.*ipmievd" /var/adm/messages`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   230
    ipmitool event $num > ipmitool.syslog_event_$num.out
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   231
    rc=$?
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   232
    [ $rc -ne 0 ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   233
	echo "$cmd_warn $tnm ipmitool exit code $rc"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   234
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   235
    sleep $SYSLOG_DELAY_SEC
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   236
    cnt2=`grep -i -c "$now.*ipmievd" /var/adm/messages`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   237
    cnt3=`expr $cnt1 + 1` # expected val
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   238
    [ $cnt2 -lt $cnt3 ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   239
	echo "$cmd_err $tnm not syslogged in $SYSLOG_DELAY_SEC sec" ; exit 1
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   240
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   241
    [ $cnt2 -gt $cnt3 ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   242
	echo "$cmd_warn $tnm more syslog entries seen than expected"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   243
    }
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   244
    echo "$cmd_info $tnm passed"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   245
} # test_syslog_event()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   246
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   247
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   248
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   249
# main()
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   250
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   251
while getopts r: opt; do # {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   252
    case $opt in
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   253
	r)  proto_root="$OPTARG";;
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   254
	-)  break;;
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   255
	\?) echo "$cmd_err bad option(s)" ; usage ; exit 22;;
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   256
    esac
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   257
done # } while grabbing cmd line args
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   258
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   259
shift `expr $OPTIND - 1`
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   260
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   261
too_much="$1"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   262
[ "$too_much" != "" ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   263
    echo "$cmd_err too few/many args" ; usage ; exit 7
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   264
}
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   265
[ "$proto_root" != "" ] && [ ! -d $proto_root ] && {
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   266
    echo "$cmd_err proto_root $proto_root not a dir" ; usage ; exit 20
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   267
}
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   268
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   269
PATH="${bin_path}:$PATH"
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   270
export PATH
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   271
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   272
# ----------------------------------------------------------------------------
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   273
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   274
enforce_i386
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   275
install_proto
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   276
show_env
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   277
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   278
test_opt_version
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   279
test_opt_help
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   280
test_svc_online
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   281
test_syslog_init
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   282
# Design_Note: not all platforms appear to support event 3 (ECC);
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   283
#              so skip it and just do events 1 and 2.
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   284
for n in 1 2; do
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   285
    test_syslog_event $n
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   286
done
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   287
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   288
uninstall_proto
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   289
6518166b581c 7047461 "temporarily" restore sfw version of ipmitool to userland
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   290
echo "$cmd_info all tests passed"	# if reach here then aok