From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- .../laptop-mode-tools/files/laptop_mode.init-1.4 | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 app-laptop/laptop-mode-tools/files/laptop_mode.init-1.4 (limited to 'app-laptop/laptop-mode-tools/files') diff --git a/app-laptop/laptop-mode-tools/files/laptop_mode.init-1.4 b/app-laptop/laptop-mode-tools/files/laptop_mode.init-1.4 new file mode 100644 index 000000000000..eef819913cc6 --- /dev/null +++ b/app-laptop/laptop-mode-tools/files/laptop_mode.init-1.4 @@ -0,0 +1,52 @@ +#!/sbin/openrc-run +# Copyright 1999-2012 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +extra_started_commands="reload" + +depend() { + need localmount + use acpid hald + after bootmisc +} + +checkconfig() { + if [ ! -f /proc/sys/vm/laptop_mode ] ; then + eerror "Kernel does not support laptop_mode" + return 1 + fi +} + +start() { + checkconfig || return 1 + + ebegin "Starting laptop_mode" + # bug #342049 fix + # check if dir exists and creates if it doesn't + checkpath -q -d -m 755 /var/run/laptop-mode-tools + touch /var/run/laptop-mode-tools/enabled + /usr/sbin/laptop_mode auto >/dev/null + eend $? +} + +stop() { + ebegin "Stopping laptop_mode" + rm -f /var/run/laptop-mode-tools/enabled + /usr/sbin/laptop_mode stop >/dev/null + eend $? +} + +reload() { + if ! service_started "${SVCNAME}" ; then + eerror "${SVCNAME} has not yet been started" + return 1 + fi + + ebegin "Reloading laptop_mode" + /usr/sbin/laptop_mode stop >/dev/null + rm -f /var/run/laptop-mode-tools/* + /usr/sbin/laptop_mode auto force >/dev/null + eend $? +} + +# vim: set ts=4 : -- cgit v1.2.3