#!/bin/sh
# Installs the steamtv-agent systemd unit.
#
# The package itself arrives under /opt/steamtv-agent via includes.chroot and runs on
# the system interpreter against apt's python3-paho-mqtt, so there is nothing to
# pip-install and no PEP 668 problem to work around here.
set -eu

install -m 0644 /opt/steamtv-agent/steamtv-agent.service \
  /etc/systemd/system/steamtv-agent.service

chmod 0644 /etc/steamtv-agent/config.env
chown -R root:root /opt/steamtv-agent

# Writable runtime state (the persisted audio-output choice) — steamtv_agent's
# runtime_state.py seeds this from the read-only templates in /etc on first start, and
# cannot create the directory itself once /etc is a squashfs.
install -d -m 0755 /var/lib/steamtv-agent

systemctl enable steamtv-agent
