base-files/leds: merging code sequences that belongs together

Setting the trigger and checking whether the trigger can be set belong
together and should not be interrupted by other lines of code.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert 2024-02-01 11:31:20 +01:00
parent 102855b3c1
commit 3aa812d8be
1 changed files with 2 additions and 3 deletions

View File

@ -65,12 +65,11 @@ load_led() {
[ "$default" = 0 ] &&
echo 0 >/sys/class/leds/${sysfs}/brightness
echo $trigger > /sys/class/leds/${sysfs}/trigger 2> /dev/null
ret="$?"
[ $default = 1 ] &&
cat /sys/class/leds/${sysfs}/max_brightness > /sys/class/leds/${sysfs}/brightness
echo $trigger > /sys/class/leds/${sysfs}/trigger 2> /dev/null
ret="$?"
[ $ret = 0 ] || {
echo >&2 "Skipping trigger '$trigger' for led '$name' due to missing kernel module"
return 1