Files
at2-root-scripts/update_fancontrol.sh
2025-04-13 16:14:17 +02:00

32 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Pfad zur aktuellen fancontrol Konfiguration und den Alternativen
CURRENT_CONFIG="/etc/fancontrol"
CONFIG_HWMON1="/etc/fancontrol.hwmon1"
CONFIG_HWMON2="/etc/fancontrol.hwmon2"
# Überprüfen und Kopieren der entsprechenden Konfigurationsdatei
update_config() {
for i in 1 2; do
if [ -L "/sys/class/hwmon/hwmon$i" ]; then
# Ziel des Symlinks auslesen
link_target=$(readlink -f "/sys/class/hwmon/hwmon$i")
# Überprüfen, ob der Symlink auf das erwartete Ziel zeigt
if [[ "$link_target" == *"/devices/pci0000:00/0000:00:18.3/hwmon/hwmon$i"* ]]; then
# Entsprechende Konfigurationsdatei kopieren
echo "Kopiere /etc/fancontrol.hwmon$i nach /etc/fancontrol..."
cp "/etc/fancontrol.hwmon$i" "$CURRENT_CONFIG"
# fancontrol Dienst neu starten
systemctl restart fancontrol
echo "fancontrol Dienst wurde neu gestartet."
return
fi
fi
done
echo "Keine passende hwmon Konfiguration gefunden."
}
# Konfigurationsupdate-Funktion aufrufen
update_config