summaryrefslogtreecommitdiff
path: root/system/hal/rc.hald
blob: 5a73edf1f90985e1d39b43dc158e5a5493ca7571 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/sh
# Start/stop/restart the hal daemon:

PIDFILE=/var/run/hald.pid

hal_start()
{
  if [ -x /usr/sbin/hald ]; then
    if [ $(uname -r | cut -d. -f1) -ge 2 ]; then
      if [ $(uname -r | cut -d. -f2) -ge 6 ]; then
        echo "Starting HAL daemon:  /usr/sbin/hald"
        /usr/sbin/hald --daemon=yes
      else
        echo "You must be running a 2.6 kernel for HAL to work. "
        exit 1
      fi
    else
      echo "You must be running a 2.6 kernel for HAL to work. "
      exit 1
    fi
  fi
}

hal_stop()
{
  kill $(cat $PIDFILE) || killall hald
  rm -f $PIDFILE
}

# See how we were called.
case "$1" in
    start)
        hal_start
        ;;
    stop)
        hal_stop
        ;;
    restart)
        hal_stop
	sleep 1
        hal_start
        ;;
    *)
        echo $"Usage: $0 {start|stop|restart}"
        ;;
esac