blob: 0de6029867e01d85a699d0e0dd3d70edd12cba1b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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
}
|