aboutsummaryrefslogtreecommitdiff
path: root/sbin/init/rc.d/apm
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/init/rc.d/apm')
-rwxr-xr-xsbin/init/rc.d/apm47
1 files changed, 47 insertions, 0 deletions
diff --git a/sbin/init/rc.d/apm b/sbin/init/rc.d/apm
new file mode 100755
index 000000000000..55e33d0741e4
--- /dev/null
+++ b/sbin/init/rc.d/apm
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: apm
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="apm"
+desc="Advanced power management"
+rcvar="apm_enable"
+start_precmd="apm_precmd"
+command="/usr/sbin/${name}"
+start_cmd="${command} -e enable"
+stop_cmd="${command} -e disable"
+status_cmd="apm_status"
+
+apm_precmd()
+{
+ case `${SYSCTL_N} hw.machine_arch` in
+ i386)
+ return 0
+ ;;
+ esac
+ return 1
+}
+
+apm_status()
+{
+ case `${command} -s` in
+ 1)
+ echo "APM is enabled."
+ return 0
+ ;;
+ 0)
+ echo "APM is disabled"
+ ;;
+ esac
+ return 1
+}
+
+load_rc_config $name
+run_rc_command "$1"