#!/bin/bash
set -e

# This script installs, enables, and restarts the auracast-script user service
# No sudo is required as it is a user service

# Copy user service file for auracast-script
mkdir -p /home/caster/.config/systemd/user
cp /home/caster/bumble-auracast/src/service/auracast-script.service /home/caster/.config/systemd/user/auracast-script.service

# Reload systemd to recognize new/updated services
systemctl --user daemon-reload

# Enable service to start on user login
systemctl --user enable auracast-script.service

# Restart service
systemctl --user restart auracast-script.service

echo "\n--- auracast-script.service status (user) ---"
systemctl --user status auracast-script.service --no-pager

echo "auracast-script service updated, enabled, restarted, and status printed successfully."
