mirror of
https://github.com/playit-cloud/playit-agent.git
synced 2026-07-03 07:12:29 +00:00
* 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
41 lines
643 B
Bash
Executable File
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
|