File rc.hal of Package hal
#!/bin/sh
# Author: Danny Kukawka <dkukawka@suse.de>
#
# /etc/init.d/rchal
#
### BEGIN INIT INFO
# Provides: haldaemon
# Required-Start: boot.localnet dbus
# Should-Start: acpid resmgr cpufreq
# Required-Stop: $null
# Should-Stop: $null
# Default-Start: 2 3 5
# Default-Stop:
# Short-Description: HAL is a daemon for managing information about the hardware on the system
# Description: HAL is a hardware abstraction layer and aims to provide a live list of devices present
# in the system at any point in time. HAL tries to understand both physical devices (such
# as PCI, USB) and the device classes (such as input, net and block) physical devices have,
# and it allows merging of information from so called device info files specific to a device.
# HAL provides a network API through D-BUS for querying devices and notifying when things
# change. Finally, HAL provides some monitoring (in an unintrusive way) of devices, presently
# ethernet link detection and volume mounts are monitored. This, and more, is all described
# in the HAL specification
#
### END INIT INFO
# Check for binary
HALDAEMON_BIN=/usr/sbin/hald
test -x $HALDAEMON_BIN || exit 5
# Parameters (startup)
HALDAEMON_PARA="--daemon=yes";
HALDAEMON_PIDDIR="/var/run/hald";
HALDAEMON_PID=$HALDAEMON_PIDDIR/haldaemon.pid;
DBUSDAEMON_PID=/var/run/dbus/pid;
# Source LSB init functions
# providing start_daemon, killproc, pidofproc,
# log_success_msg, log_failure_msg and log_warning_msg.
# This is currently not used by UnitedLinux based distributions and
# not needed for init scripts for UnitedLinux only. If it is used,
# the functions from rc.status should not be sourced or used.
#. /lib/lsb/init-functions
. /etc/rc.status
# Reset status of this service
rc_reset
case "$1" in
start)
if [ ! -d $HALDAEMON_PIDDIR ]; then
mkdir -p $HALDAEMON_PIDDIR;
mkdir -p $HALDAEMON_PIDDIR/hald-runner $HALDAEMON_PIDDIR/hald-local
chown haldaemon:haldaemon $HALDAEMON_PIDDIR \
$HALDAEMON_PIDDIR/hald-runner $HALDAEMON_PIDDIR/hald-local
fi
echo -n "Starting HAL daemon"
start_daemon $HALDAEMON_BIN $HALDAEMON_PARA
if [ -n "$INIT_VERSION" ] ; then
rm -rf /media/.hal-mtab*
fi
rc_status -v
;;
start-with-dbus)
if [ ! -e $DBUSDAEMON_PID ]; then
echo -n "DBUS is not running. Starting D-BUS daemon";
rcdbus start;
fi
$0 start
;;
stop)
echo -n "Shutting down HAL daemon"
killproc -p $HALDAEMON_PID -TERM $HALDAEMON_BIN
rc_status
rm -f $HALDAEMON_PID;
rc_status -v
;;
try-restart)
$0 status >/dev/null && $0 restart
rc_status
;;
restart)
$0 stop
$0 start
;;
force-reload)
$0 try-restart
rc_status
;;
reload)
rc_failed 3
rc_status -v
;;
status)
echo -n "Checking for service HAL daemon"
checkproc $HALDAEMON_BIN
rc_status -v
;;
probe)
## Optional: Probe for the necessity of a reload, print out the
## argument to this init script which is required for a reload.
## Note: probe is not (yet) part of LSB (as of 1.2)
# test /etc/FOO/FOO.conf -nt /var/run/FOO.pid && echo reload
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|start-with-dbus|reload|probe}"
exit 1
;;
esac
rc_exit