Skip to content

Commit

Permalink
base-files: don't wipe LED state when adding a single LED
Browse files Browse the repository at this point in the history
Only replace LED state of a single LED instead of removing the entire
/var/run/led.state file.

Fixes: 511e8f8 ("base-files: configure LED when added")
Signed-off-by: Daniel Golle <[email protected]>
  • Loading branch information
dangowrt committed Oct 7, 2024
1 parent 0b05cc7 commit dae6a87
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion package/base-files/files/etc/init.d/led
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,12 @@ start() {
echo "$color" | sed 's/:/\ /g' > \
"/sys/class/leds/$led/multi_intensity"
done < /var/run/led.state
rm /var/run/led.state
if [ "$1" ]; then
grep -v "^$1 " /var/run/led.state > /var/run/led.state.new
mv /var/run/led.state.new /var/run/led.state
else
rm /var/run/led.state
fi
}

config_load system
Expand Down

0 comments on commit dae6a87

Please sign in to comment.