svc-dbus revision 12038
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.
16437N/A#
16680N/A# When distributing Covered Code, include this CDDL HEADER in each
10139N/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#
16207N/A# CDDL HEADER END
10139N/A#
10139N/A# Copyright 2006 Sun Microsystems, Inc. All rights reserved.
15536N/A# Use is subject to license terms.
15536N/A#
15536N/A# ident "@(#)svc-dbus 1.1 06/04/24 SMI"
15536N/A
15536N/AFMRI=svc:/system/dbus:default
16554N/A
15761N/A. /lib/svc/share/smf_include.sh
15761N/A
15761N/Aif [ ! -x /usr/lib/dbus-daemon ]; then
15761N/A echo "/usr/lib/dbus-daemon not found or not executable"
16554N/A exit $SMF_EXIT_ERR_FATAL
16554N/Afi
16554N/A
10139N/A# Generate machine-id regardless of zones
16633N/Aif [ ! -f /var/lib/dbus/machine-id ]; then
11999N/A /usr/bin/dbus-uuidgen --ensure
15536N/Afi
10139N/A
10139N/Aif smf_is_nonglobalzone; then
10139N/A /usr/sbin/svcadm disable -t svc:/system/dbus
15536N/A echo "dbus-daemon cannot be run in non-global zones"
10139N/A sleep 5 &
13898N/A exit $SMF_EXIT_OK
13898N/Afi
15536N/A
10139N/Acase "$1" in
16437N/A'start')
16437N/A # temporary hacks
16437N/A if [ ! -d /var/run/dbus ]; then
10544N/A mkdir /var/run/dbus
12830N/A fi
12830N/A if [ -f /var/run/dbus/pid ]; then
15536N/A rm -f /var/run/dbus/pid
12830N/A fi
13914N/A
13915N/A /usr/lib/dbus-daemon --system
15536N/A err=$?
13914N/A if [ $err -ne 0 ]; then
16680N/A echo "dbus failed to start: error $err"
15536N/A exit $SMF_EXIT_ERR_FATAL
14425N/A fi
16680N/A
15536N/A ;;
15190N/A*)
16597N/A echo "Usage: $0 { start }"
15536N/A exit $SMF_EXIT_ERR_FATAL
15536N/A ;;
15216N/Aesac
15418N/A
15536N/Aexit $SMF_EXIT_OK
15418N/A