Merge from vendor branch LIBSTDC++:
[dragonfly.git] / etc / rc.d / apmd
1 #!/bin/sh
2 #
3 # $NetBSD: apmd,v 1.5 2002/03/22 04:33:58 thorpej Exp $
4 # $FreeBSD: src/etc/rc.d/apmd,v 1.8 2003/06/09 17:44:30 mtm Exp $
5 # $DragonFly: src/etc/rc.d/apmd,v 1.1 2003/07/24 06:35:37 dillon Exp $
6 #
7
8 # PROVIDE: apmd
9 # REQUIRE: DAEMON apm
10 # BEFORE:  LOGIN
11 # KEYWORD: DragonFly FreeBSD NetBSD 
12
13 . /etc/rc.subr
14
15 name="apmd"
16 rcvar=`set_rcvar`
17 command="/usr/sbin/${name}"
18
19 case ${OSTYPE} in
20 DragonFly)
21         start_precmd="apmd_prestart"
22         ;;
23 FreeBSD)
24         start_precmd="apmd_prestart"
25         ;;
26 esac
27
28 apmd_prestart()
29 {
30         case `${SYSCTL_N} hw.machine_arch` in
31         i386)
32                 # Enable apm if it is not already enabled
33                 if ! checkyesno apm_enable  && \
34                     ! /etc/rc.d/apm forcestatus 1>/dev/null 2>&1
35                 then
36                         force_depend apm || return 1
37                 fi
38
39                 # Warn user about acpi apm compatibility support which
40                 # does not work with apmd.
41                 if [ ! -e /dev/apmctl ]; then
42                     warn "/dev/apmctl not found; kernel is missing apm(4)"
43                 fi
44                 ;;
45         *)
46                 return 1
47                 ;;
48         esac
49         return 0
50 }
51
52 load_rc_config $name
53 run_rc_command "$1"