From 45fac6d694e8a534cbaf4f20b90e73235e5316d2 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Sun, 17 Nov 2024 13:29:41 +0100 Subject: [PATCH] ledcontrol: fix disk number Signed-off-by: AuxXxilium --- ledcontrol/all/usr/bin/ledcontrol.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ledcontrol/all/usr/bin/ledcontrol.sh b/ledcontrol/all/usr/bin/ledcontrol.sh index 13893ea..bc2d1a2 100755 --- a/ledcontrol/all/usr/bin/ledcontrol.sh +++ b/ledcontrol/all/usr/bin/ledcontrol.sh @@ -44,11 +44,12 @@ else ${UGREEN_LEDS_CLI} power -on -color 255 255 255 -brightness 255 >/dev/null 2>&1 # Disks - devices=$(ls -d /dev/sata*[1-9] 2>/dev/null | grep -v 'p') + devices=$(($(ls -d /dev/sata*[1-9] 2>/dev/null | grep -v 'p' | wc -l) - 1)) disk_number=0 - for i in ${devices}; do - disk_number=$((${disk_number} + 1)) # Disknummer für die LED-Steuerung (disk1, disk2, etc.) + while true; do + disk_number=$((disk_number + 1)) ${UGREEN_LEDS_CLI} disk${disk_number} -on -color 0 255 0 -brightness 255 >/dev/null 2>&1 + [ ${disk_number} -eq ${devices} ] && break done fi