Merge from vendor branch SENDMAIL:
[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.3 2005/11/19 21:47:32 swildner Exp $
6 #
7
8 # PROVIDE: apmd
9 # REQUIRE: DAEMON apm
10 # BEFORE:  LOGIN
11
12 . /etc/rc.subr
13
14 name="apmd"
15 rcvar=`set_rcvar`
16 command="/usr/sbin/${name}"
17 start_precmd="apmd_prestart"
18 apmd_prestart()
19 {
20         case `${SYSCTL_N} hw.machine_arch` in
21         i386)
22                 # Enable apm if it is not already enabled
23                 if ! checkyesno apm_enable  && \
24                     ! /etc/rc.d/apm forcestatus 1>/dev/null 2>&1
25                 then
26                         force_depend apm || return 1
27                 fi
28
29                 # Warn user about acpi apm compatibility support which
30                 # does not work with apmd.
31                 if [ ! -e /dev/apmctl ]; then
32                     warn "/dev/apmctl not found; kernel is missing apm(4)"
33                 fi
34                 ;;
35         *)
36                 return 1
37                 ;;
38         esac
39         return 0
40 }
41
42 load_rc_config $name
43 run_rc_command "$1"