73 lines
1.6 KiB
Bash
73 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
echo "=== UGREEN LED/Disk Fix after Proxmox Kernel Update ==="
|
|
|
|
KERNEL="$(uname -r)"
|
|
echo "Detected kernel: $KERNEL"
|
|
|
|
MODULE_NAME="led-ugreen"
|
|
MODULE_FILE="led-ugreen.ko"
|
|
|
|
echo ""
|
|
echo "=== Checking if module exists on disk ==="
|
|
MODPATH="/lib/modules/$KERNEL"
|
|
FOUND=$(find "$MODPATH" -name "$MODULE_FILE" 2>/dev/null || true)
|
|
|
|
if [ -z "$FOUND" ]; then
|
|
echo "❌ Module file not found in $MODPATH"
|
|
echo "→ DKMS build required"
|
|
else
|
|
echo "✓ Module exists at:"
|
|
echo "$FOUND"
|
|
fi
|
|
|
|
echo ""
|
|
echo "=== Checking DKMS status ==="
|
|
dkms status ugreen-led/0.1 || true
|
|
|
|
echo ""
|
|
if [ -z "$FOUND" ]; then
|
|
echo "=== DKMS: Reinstalling ugreen-led for kernel $KERNEL ==="
|
|
dkms remove ugreen-led/0.1 -k "$KERNEL" --force 2>/dev/null || true
|
|
dkms install ugreen-led/0.1 -k "$KERNEL"
|
|
else
|
|
echo "Skipping DKMS rebuild (module already present)"
|
|
fi
|
|
|
|
echo ""
|
|
echo "=== Running depmod ==="
|
|
depmod -a "$KERNEL"
|
|
|
|
echo ""
|
|
echo "=== Loading module ==="
|
|
modprobe -v "$MODULE_NAME" || {
|
|
echo "❌ Could not load module even after DKMS rebuild!"
|
|
exit 1
|
|
}
|
|
|
|
echo ""
|
|
echo "=== Probing UGREEN LEDs ==="
|
|
UGREEN_PROBE="./ugreen_leds_controller/scripts/ugreen-probe-leds"
|
|
|
|
if [[ -x "$UGREEN_PROBE" ]]; then
|
|
$UGREEN_PROBE
|
|
else
|
|
echo "⚠️ Probe script not found: $UGREEN_PROBE"
|
|
fi
|
|
|
|
echo ""
|
|
echo "=== Restarting services ==="
|
|
systemctl daemon-reload
|
|
systemctl start ugreen-netdevmon@enp2s0
|
|
systemctl status --no-pager ugreen-netdevmon@enp2s0 || true
|
|
|
|
echo ""
|
|
echo "=== Fixing Disk I/O Monitor ==="
|
|
systemctl start ugreen-diskiomon
|
|
systemctl enable ugreen-diskiomon
|
|
systemctl status --no-pager ugreen-diskiomon || true
|
|
|
|
echo ""
|
|
echo "=== Done. ==="
|