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