xref: /illumos-gate/usr/src/cmd/hal/hald/solaris/svc-hal (revision 18c2aff7)
1#!/sbin/sh
2#
3# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
4# Use is subject to license terms.
5#
6# Licensed under the Academic Free License version 2.1
7#
8# ident	"%Z%%M%	%I%	%E% SMI"
9
10. /lib/svc/share/smf_include.sh
11
12case "$1" in
13'start')
14        if smf_is_nonglobalzone; then
15                /usr/sbin/svcadm disable $SMF_FMRI
16                echo "$SMF_FMRI is not supported in a local zone"
17                sleep 5 &
18                exit $SMF_EXIT_OK
19        fi
20
21	[ ! -x /usr/lib/hal/hald ] && exit $SMF_EXIT_ERR_CONFIG
22
23	[ ! -d /var/run/hald ] && /usr/bin/mkdir -m 755 /var/run/hald
24	[ ! -d /media ] && /usr/bin/mkdir -m 755 /media
25
26	/usr/lib/hal/hald --daemon=yes
27	err=$?
28	if [ $err -ne 0 ]; then
29		echo "hal failed to start: error $err"
30		exit $SMF_EXIT_ERR_FATAL
31	fi
32	;;
33*)
34        echo "Usage: $0 { start }"
35	exit $SMF_EXIT_ERR_FATAL
36        ;;
37esac
38
39exit $SMF_EXIT_OK
40