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