mirror of
https://github.com/playit-cloud/playit-agent.git
synced 2026-07-05 09:08:38 +00:00
- 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
48 lines
790 B
Bash
Executable File
48 lines
790 B
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
have_command() {
|
|
command -v "$1" >/dev/null 2>&1
|
|
}
|
|
|
|
is_upgrade() {
|
|
case "${1:-}" in
|
|
upgrade|upgrading|1)
|
|
return 0
|
|
;;
|
|
*)
|
|
return 1
|
|
;;
|
|
esac
|
|
}
|
|
|
|
if is_upgrade "${1:-}"; then
|
|
exit 0
|
|
fi
|
|
|
|
if have_command systemctl; then
|
|
systemctl stop playit || true
|
|
systemctl disable playit || true
|
|
fi
|
|
|
|
if have_command rc-service; then
|
|
rc-service playit stop || true
|
|
fi
|
|
|
|
if have_command rc-update; then
|
|
rc-update del playit default || true
|
|
fi
|
|
|
|
rm -f /lib/systemd/system/playit.service
|
|
rm -f /usr/lib/systemd/system/playit.service
|
|
rm -f /etc/init.d/playit
|
|
rm -f /opt/playit/share/init/selected-manager
|
|
|
|
if [ -L /usr/local/bin/playit ]; then
|
|
rm -f /usr/local/bin/playit
|
|
fi
|
|
|
|
if [ -L /usr/local/bin/playitd ]; then
|
|
rm -f /usr/local/bin/playitd
|
|
fi
|