[openwrt/openwrt] base-files: don't wipe LED state when adding a single LED
LEDE Commits
lede-commits at lists.infradead.org
Sun Oct 6 17:42:38 PDT 2024
dangole pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/dae6a871de3df0adca5b7f29a32c8c0642a9415e
commit dae6a871de3df0adca5b7f29a32c8c0642a9415e
Author: Daniel Golle <daniel at makrotopia.org>
AuthorDate: Sat Oct 5 18:20:35 2024 +0100
base-files: don't wipe LED state when adding a single LED
Only replace LED state of a single LED instead of removing the entire
/var/run/led.state file.
Fixes: 511e8f84d0 ("base-files: configure LED when added")
Signed-off-by: Daniel Golle <daniel at makrotopia.org>
---
package/base-files/files/etc/init.d/led | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led
index 5130ac7d41..7f05254c2b 100755
--- a/package/base-files/files/etc/init.d/led
+++ b/package/base-files/files/etc/init.d/led
@@ -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
More information about the lede-commits
mailing list