5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
26 # Copyright 2016 Jim Klimov
28 # ident "@(#)svc-ipmidetectd 1.1 09/08/14 SMI"
30 # These are the SMF start/stop/restart methods for ipmiseld.
33 .
/lib
/svc
/share
/smf_include.sh
35 [ -n "${SMF_FMRI-}" ] || \
36 SMF_FMRI
="svc:/system/freeipmi/ipmiseld"
39 # No arguments provided - report current status (use "-c" option to
40 # svcprop to get the current properties, otherwise false will result)
41 if [ "`/usr/bin/svcs -Ho STATE $SMF_FMRI`" = "enabled" ]
43 echo "svc-ipmiseld: ipmiseld is enabled"
45 echo "svc-ipmiseld: ipmiseld is disabled"
50 # ipmiseld requires the presence of a BMC character device
51 # to run. If one is not detected, then disable the service
53 # UPDATE: Actually it can also work over network, so our SMF
54 # manifest default (in XML) is BMCDEVREQ="false".
56 [ -n "$SMF_FMRI" ] && \
57 BMCDEV
="`/usr/bin/svcprop -p config/bmcdev "$SMF_FMRI"`" \
59 || BMCDEV
="/dev/ipmi0"
60 # NOTE: OpenSolaris legacy (proprietary driver) used and required /dev/bmc
61 [ -n "$SMF_FMRI" ] && \
62 BMCDEVREQ
="`/usr/bin/svcprop -p config/bmcdev-required "$SMF_FMRI"`" \
63 && [ -n "$BMCDEVREQ" ] \
66 if [ ! -c "$BMCDEV" ]; then
67 if [ "$BMCDEVREQ" = true
]; then
68 echo "$0: No BMC device found at \"$BMCDEV\": disabling $SMF_FMRI as the device is required in config."
69 /usr
/sbin
/svcadm disable
$SMF_FMRI
72 echo "$0: No BMC device found at \"$BMCDEV\"; config of $SMF_FMRI says we do not require one."
76 props
="`/usr/sbin/svccfg -s $SMF_FMRI listprop config/options | \
77 /usr/bin/nawk '{ for (i = 3; i <= NF; i++) printf $i" " }'`"
78 props
="`echo "$props" | sed -e 's/.\(.*\)/\1/' -e 's/\(.*\)./\1/'`"
80 if [ -z "$props" ]; then
81 echo "ipmiseld needs to be configured. Set options as \
82 svccfg -s $SMF_FMRI setprop \
83 config/options '\"-c /etc/freeipmi/ipmiseld.conf\"'"
84 exit $SMF_EXIT_ERR_CONFIG
87 echo "The ipmiseld is configured with options \"$props\"."
88 echo "If $SMF_FMRI is in maintenance state, ipmiseld failed to start - check if configuration file correct."
90 /usr
/sbin
/ipmiseld
$props > /dev
/null
2>&1 &
94 echo "Usage: $0 start"
95 exit $SMF_EXIT_ERR_FATAL