| 12345678910111213141516171819202122232425262728293031323334353637 |
- #!/usr/bin/env bash
- set -euo pipefail
- NAME="amd-gpu-temp-control"
- SELF="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
- SRC="$SELF/$NAME.js"
- TPL="$SELF/$NAME.service"
- BINARY="/usr/local/bin/$NAME"
- DEST="/etc/systemd/system/$NAME.service"
- install() {
- [[ -f "$TPL" ]] || { echo "Missing $NAME.service template"; exit 1; }
- [[ -f "$SRC" ]] || { echo "Missing $NAME.js"; exit 1; }
- command -v node &>/dev/null || { echo "node not found"; exit 1; }
- command -v upp &>/dev/null || { echo "upp not found in PATH"; exit 1; }
- cp "$SRC" "$BINARY"
- chmod +x "$BINARY"
- cp "$TPL" "$DEST"
- systemctl daemon-reload
- systemctl enable "$NAME.service"
- systemctl restart "$NAME.service"
- echo "Installed — journalctl -u $NAME -f"
- }
- uninstall() {
- systemctl stop "$NAME" 2>/dev/null || true
- systemctl disable "$NAME" 2>/dev/null || true
- rm -f "$DEST" "$BINARY"
- systemctl daemon-reload
- echo "Uninstalled."
- }
- case "${1:-}" in
- --uninstall) uninstall ;;
- *) install ;;
- esac
|