#!/usr/bin/env bash set -euo pipefail REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" BIN_DIR="$HOME/.local/bin" SYSTEMD_DIR="$HOME/.config/systemd/user" CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}/revive-monitor" mkdir -p "$BIN_DIR" "$SYSTEMD_DIR" "$CONFIG_DIR" install -m 0755 "$REPO_ROOT/scripts/revive-monitor-fix.sh" "$BIN_DIR/revive-monitor-fix" install -m 0755 "$REPO_ROOT/scripts/revive-monitor-drm-watch.sh" "$BIN_DIR/revive-monitor-drm-watch" install -m 0644 "$REPO_ROOT/systemd/user/revive-monitor-drm-watch.service" "$SYSTEMD_DIR/revive-monitor-drm-watch.service" if [[ ! -e "$CONFIG_DIR/config.env" ]]; then install -m 0644 "$REPO_ROOT/config/revive-monitor.env.example" "$CONFIG_DIR/config.env" printf 'Created %s\n' "$CONFIG_DIR/config.env" printf 'Edit MONITOR before using the service if your output is not HDMI-A-2.\n' else printf 'Keeping existing config: %s\n' "$CONFIG_DIR/config.env" fi systemctl --user daemon-reload systemctl --user enable --now revive-monitor-drm-watch.service cat <<'MSG' Installed successfully. Next steps: 1. Verify ~/.config/revive-monitor/config.env 2. Configure /etc/sudoers.d/revive-monitor-chvt using one of the templates in sudoers/ 3. Test with: systemctl --user status revive-monitor-drm-watch.service 4. Watch logs: journalctl --user -u revive-monitor-drm-watch.service -f MSG