xref: /freebsd/libexec/rc/rc.d/apm (revision f99f0ee14e3af81c23150a6a340259ca8a33d01a)
10696600cSBjoern A. Zeeb#!/bin/sh
20696600cSBjoern A. Zeeb#
30696600cSBjoern A. Zeeb#
40696600cSBjoern A. Zeeb
50696600cSBjoern A. Zeeb# PROVIDE: apm
60696600cSBjoern A. Zeeb# REQUIRE: DAEMON
70696600cSBjoern A. Zeeb# BEFORE:  LOGIN
80696600cSBjoern A. Zeeb# KEYWORD: nojail
90696600cSBjoern A. Zeeb
100696600cSBjoern A. Zeeb. /etc/rc.subr
110696600cSBjoern A. Zeeb
120696600cSBjoern A. Zeebname="apm"
130696600cSBjoern A. Zeebdesc="Advanced power management"
140696600cSBjoern A. Zeebrcvar="apm_enable"
150696600cSBjoern A. Zeebstart_precmd="apm_precmd"
160696600cSBjoern A. Zeebcommand="/usr/sbin/${name}"
170696600cSBjoern A. Zeebstart_cmd="${command} -e enable"
180696600cSBjoern A. Zeebstop_cmd="${command} -e disable"
190696600cSBjoern A. Zeebstatus_cmd="apm_status"
200696600cSBjoern A. Zeeb
210696600cSBjoern A. Zeebapm_precmd()
220696600cSBjoern A. Zeeb{
230696600cSBjoern A. Zeeb	case `${SYSCTL_N} hw.machine_arch` in
240696600cSBjoern A. Zeeb	i386)
250696600cSBjoern A. Zeeb		return 0
260696600cSBjoern A. Zeeb		;;
270696600cSBjoern A. Zeeb	esac
280696600cSBjoern A. Zeeb	return 1
290696600cSBjoern A. Zeeb}
300696600cSBjoern A. Zeeb
310696600cSBjoern A. Zeebapm_status()
320696600cSBjoern A. Zeeb{
330696600cSBjoern A. Zeeb	case `${command} -s` in
340696600cSBjoern A. Zeeb	1)
350696600cSBjoern A. Zeeb		echo "APM is enabled."
360696600cSBjoern A. Zeeb		return 0
370696600cSBjoern A. Zeeb		;;
380696600cSBjoern A. Zeeb	0)
390696600cSBjoern A. Zeeb		echo "APM is disabled"
400696600cSBjoern A. Zeeb		;;
410696600cSBjoern A. Zeeb	esac
420696600cSBjoern A. Zeeb	return 1
430696600cSBjoern A. Zeeb}
440696600cSBjoern A. Zeeb
450696600cSBjoern A. Zeebload_rc_config $name
46*f99f0ee1SAlexander Leidinger
47*f99f0ee1SAlexander Leidinger# doesn't make sense to run in a svcj: nojail keyword
48*f99f0ee1SAlexander Leidingerapm_svcj="NO"
49*f99f0ee1SAlexander Leidinger
500696600cSBjoern A. Zeebrun_rc_command "$1"
51