xref: /freebsd/libexec/rc/rc.d/apm (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1#!/bin/sh
2#
3# $FreeBSD$
4#
5
6# PROVIDE: apm
7# REQUIRE: DAEMON
8# BEFORE:  LOGIN
9# KEYWORD: nojail
10
11. /etc/rc.subr
12
13name="apm"
14desc="Advanced power management"
15rcvar="apm_enable"
16start_precmd="apm_precmd"
17command="/usr/sbin/${name}"
18start_cmd="${command} -e enable"
19stop_cmd="${command} -e disable"
20status_cmd="apm_status"
21
22apm_precmd()
23{
24	case `${SYSCTL_N} hw.machine_arch` in
25	i386)
26		return 0
27		;;
28	esac
29	return 1
30}
31
32apm_status()
33{
34	case `${command} -s` in
35	1)
36		echo "APM is enabled."
37		return 0
38		;;
39	0)
40		echo "APM is disabled"
41		;;
42	esac
43	return 1
44}
45
46load_rc_config $name
47run_rc_command "$1"
48