Files
playit-agent/linux/playit
T
Patrick LorioandGitHub 7a61d15903 Add optional Linux service manager selection (#175)
* Add optional service manager selection for installed playit

- Add `--systemd` and `--openrc` on Linux
- Route start/stop/setup flows through the selected manager
- Add OpenRC support and manager-specific error messages

* Add init-manager aware Linux packaging

- Package systemd and OpenRC service files from one nfpm config
- Detect the active init system in postinstall and install the matching service
- Route `linux/playit` through the chosen manager when present
2026-06-04 12:33:47 -07:00

41 lines
643 B
Bash
Executable File

#!/bin/sh
set -eu
MANAGER_FILE=/opt/playit/share/init/selected-manager
has_service_manager_flag() {
for arg in "$@"; do
case "$arg" in
--systemd|--openrc)
return 0
;;
--)
return 1
;;
esac
done
return 1
}
if has_service_manager_flag "$@"; then
exec /opt/playit/agent "$@"
fi
manager=none
if [ -r "$MANAGER_FILE" ]; then
manager="$(cat "$MANAGER_FILE" 2>/dev/null || printf '%s\n' none)"
fi
case "$manager" in
systemd)
exec /opt/playit/agent --systemd "$@"
;;
openrc)
exec /opt/playit/agent --openrc "$@"
;;
*)
exec /opt/playit/agent "$@"
;;
esac