diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2017-10-09 18:53:29 +0100 |
commit | 4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch) | |
tree | ba5f07bf3f9d22d82e54a462313f5d244036c768 /sys-power/acpilight/files/acpilight.initd |
reinit the tree, so we can have metadata
Diffstat (limited to 'sys-power/acpilight/files/acpilight.initd')
-rw-r--r-- | sys-power/acpilight/files/acpilight.initd | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/sys-power/acpilight/files/acpilight.initd b/sys-power/acpilight/files/acpilight.initd new file mode 100644 index 000000000000..0de6029867e0 --- /dev/null +++ b/sys-power/acpilight/files/acpilight.initd @@ -0,0 +1,41 @@ +#!/sbin/openrc-run +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +state_dir=/var/lib/acpilight + +extra_commands="save restore" + +depend() { + need localmount + after bootmisc modules isapnp coldplug hotplug +} + +restore() { + ebegin "Restoring brightness level" + if [ ! -r "${state_dir}/state" ] ; then + ewarn "No brightness level in ${state_dir}/state" + eend 0 + return 0 + fi + xbacklight "$(cat "${state_dir}/state")" + eend $? +} + +save() { + ebegin "Saving brightness level" + mkdir -p "${state_dir}" && xbacklight -get > "${state_dir}/state" + eend $? +} + +start() { + if [ "${RESTORE_ON_START}" = "yes" ]; then + restore + fi +} + +stop() { + if [ "${SAVE_ON_STOP}" = "yes" ]; then + save + fi +} |