From: Andre Heider Date: Sat, 14 Dec 2024 10:27:09 +0000 (+0100) Subject: base-files: fix shell scope error for the default LED brightness X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=3c7134fa320b823ab7c5f91dd1ad948491d97478;p=openwrt%2Fstaging%2Fblocktrron.git base-files: fix shell scope error for the default LED brightness This fixes "sh: write error: Invalid argument" for all default!=1 LEDs as an empty $brightness was used. Setting up LEDs via luci also now works again. Fixes cbdfd03e: "base-files: add option to set LED brightness" Signed-off-by: Andre Heider Link: https://github.com/openwrt/openwrt/issues/17269 Signed-off-by: John Crispin --- diff --git a/package/base-files/files/etc/init.d/led b/package/base-files/files/etc/init.d/led index d292e2a8dd..79fdd452ce 100755 --- a/package/base-files/files/etc/init.d/led +++ b/package/base-files/files/etc/init.d/led @@ -106,9 +106,10 @@ load_led() { [ "$default" = 0 ] && echo 0 >/sys/class/leds/${sysfs}/brightness - [ $default = 1 ] && - [ -z "$brightness" ] && brightness=$(cat /sys/class/leds/${sysfs}/max_brightness) - echo $brightness > /sys/class/leds/${sysfs}/brightness + [ "$default" = 1 ] && { + [ -z "$brightness" ] && brightness="$(cat /sys/class/leds/${sysfs}/max_brightness)" + echo "$brightness" > /sys/class/leds/${sysfs}/brightness + } led_color_set "$1" "$sysfs"