7945N/A#!/sbin/sh
7945N/A#
7945N/A# CDDL HEADER START
7945N/A#
7945N/A# The contents of this file are subject to the terms of the
7945N/A# Common Development and Distribution License (the "License").
7945N/A# You may not use this file except in compliance with the License.
7945N/A#
7945N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
7945N/A# or http://www.opensolaris.org/os/licensing.
7945N/A# See the License for the specific language governing permissions
7945N/A# and limitations under the License.
7945N/A#
7945N/A# When distributing Covered Code, include this CDDL HEADER in each
7945N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
7945N/A# If applicable, add the following below this CDDL HEADER, with the
7945N/A# fields enclosed by brackets "[]" replaced with your own identifying
7945N/A# information: Portions Copyright [yyyy] [name of copyright owner]
7945N/A#
7945N/A# CDDL HEADER END
7945N/A#
7945N/A# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
7945N/A# Use is subject to license terms.
7945N/A#
7945N/A# ident "@(#)svc-dbus 1.1 06/04/24 SMI"
7945N/A
7945N/AFMRI=svc:/system/dbus:default
7945N/A
7945N/A. /lib/svc/share/smf_include.sh
7945N/A
8451N/Aif [ ! -x /usr/lib/dbus-daemon ]; then
8451N/A echo "/usr/lib/dbus-daemon not found or not executable"
7945N/A exit $SMF_EXIT_ERR_FATAL
7945N/Afi
7945N/A
12038N/A# Generate machine-id regardless of zones
12038N/Aif [ ! -f /var/lib/dbus/machine-id ]; then
12038N/A /usr/bin/dbus-uuidgen --ensure
12038N/Afi
12038N/A
7945N/Aif smf_is_nonglobalzone; then
9935N/A /usr/sbin/svcadm disable -t svc:/system/dbus
20188N/A echo "dbus-daemon cannot be run in non-global zones"
9935N/A sleep 5 &
9935N/A exit $SMF_EXIT_OK
7945N/Afi
7945N/A
7945N/Acase "$1" in
7945N/A'start')
7945N/A # temporary hacks
7945N/A if [ ! -d /var/run/dbus ]; then
7945N/A mkdir /var/run/dbus
7945N/A fi
7945N/A if [ -f /var/run/dbus/pid ]; then
7945N/A rm -f /var/run/dbus/pid
7945N/A fi
7945N/A
8451N/A /usr/lib/dbus-daemon --system
7945N/A err=$?
7945N/A if [ $err -ne 0 ]; then
7945N/A echo "dbus failed to start: error $err"
7945N/A exit $SMF_EXIT_ERR_FATAL
7945N/A fi
10224N/A
7945N/A ;;
7945N/A*)
7945N/A echo "Usage: $0 { start }"
7945N/A exit $SMF_EXIT_ERR_FATAL
7945N/A ;;
7945N/Aesac
7945N/A
7945N/Aexit $SMF_EXIT_OK