Three conky panels (main, dayz, doge) plus all widgets, NUT config templates, and the systemd timer that drives the qwen2.5:1.5b vibe report on maeth-storage. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
40 lines
1.4 KiB
Bash
Executable File
40 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# One-shot setup for Hikvision UPS via NUT. Run with: sudo bash ~/.config/home-assistant-energy-widget/setup-ups.sh
|
|
set -euo pipefail
|
|
|
|
if [[ $EUID -ne 0 ]]; then
|
|
echo "Re-running with sudo..."
|
|
exec sudo bash "$0" "$@"
|
|
fi
|
|
|
|
CFG_SRC="/home/maeth/.config/home-assistant-energy-widget/nut"
|
|
|
|
echo "==> Installing NUT"
|
|
pacman -S --needed --noconfirm nut
|
|
|
|
echo "==> Installing config to /etc/nut"
|
|
install -m 0640 -o root -g nut "$CFG_SRC/ups.conf" /etc/nut/ups.conf
|
|
install -m 0640 -o root -g nut "$CFG_SRC/upsd.conf" /etc/nut/upsd.conf
|
|
install -m 0640 -o root -g nut "$CFG_SRC/upsd.users" /etc/nut/upsd.users
|
|
install -m 0640 -o root -g nut "$CFG_SRC/upsmon.conf" /etc/nut/upsmon.conf
|
|
install -m 0644 -o root -g root "$CFG_SRC/nut.conf" /etc/nut/nut.conf
|
|
|
|
echo "==> Reloading udev for HID UPS rules"
|
|
udevadm control --reload
|
|
udevadm trigger --action=change --subsystem-match=usb
|
|
|
|
echo "==> Enabling NUT services"
|
|
systemctl daemon-reload
|
|
systemctl enable --now nut-driver.target
|
|
systemctl enable --now nut-server.service
|
|
systemctl enable --now nut-monitor.service
|
|
|
|
sleep 2
|
|
echo "==> Probe:"
|
|
upsc hikvision@localhost 2>&1 | head -25 || true
|
|
|
|
echo
|
|
echo "Done. If you see ups.* values above, the UPS is talking to NUT."
|
|
echo "If not, edit /etc/nut/ups.conf and uncomment one of the 'subdriver=' lines, then:"
|
|
echo " sudo systemctl restart nut-driver.target nut-server"
|