mirror of
https://github.com/playit-cloud/playit-agent.git
synced 2026-07-08 04:21:57 +00:00
* Use sysusers on systemd installs - Add packaged sysusers config for playit - Prefer systemd-sysusers when provisioning the service user - Keep legacy user creation for non-systemd init systems * Move sysusers config into bundled init path - Install the playit sysusers file under `/opt/playit/share/init/systemd` - Update postinstall to read the relocated config * Install packaged sysusers config before running sysusers - Copy the bundled playit sysusers file into `/usr/lib/sysusers.d/playit.conf` when it is missing - Then run `systemd-sysusers` against the installed config * Use /nonexistent home for playit service user - Update pre/postinstall scripts to create the service account with `/nonexistent` - Align sysusers entry with the same non-login home directory * Move playit symlinks to /usr/bin and fix sysusers install - Create the sysusers config before checking for existing accounts - Install and remove playit CLI symlinks under /usr/bin - Clean up legacy /usr/local/bin links on uninstall * Add OpenRC APK packaging support - Split OpenRC packaging into a dedicated nfpm config - Add OpenRC install and removal scripts plus package output - Update Linux packaging defaults, sysusers paths, and logrotate
62 lines
1.1 KiB
Bash
Executable File
62 lines
1.1 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
SYSTEMD_UNIT=/usr/lib/systemd/system/playit.service
|
|
|
|
have_command() {
|
|
command -v "$1" >/dev/null 2>&1
|
|
}
|
|
|
|
is_upgrade() {
|
|
case "${1:-}" in
|
|
upgrade|upgrading|1)
|
|
return 0
|
|
;;
|
|
*)
|
|
return 1
|
|
;;
|
|
esac
|
|
}
|
|
|
|
remove_legacy_unit_path() {
|
|
legacy_unit="$1"
|
|
|
|
if [ ! -e "$legacy_unit" ] && [ ! -L "$legacy_unit" ]; then
|
|
return 0
|
|
fi
|
|
|
|
if [ "$(readlink -f "$legacy_unit" 2>/dev/null || printf '%s\n' "$legacy_unit")" = "$(readlink -f "$SYSTEMD_UNIT" 2>/dev/null || printf '%s\n' "$SYSTEMD_UNIT")" ]; then
|
|
return 0
|
|
fi
|
|
|
|
rm -f "$legacy_unit"
|
|
}
|
|
|
|
if is_upgrade "${1:-}"; then
|
|
exit 0
|
|
fi
|
|
|
|
if have_command systemctl; then
|
|
systemctl stop playit || true
|
|
systemctl disable playit || true
|
|
fi
|
|
|
|
remove_legacy_unit_path /lib/systemd/system/playit.service
|
|
rm -f /opt/playit/share/init/selected-manager
|
|
|
|
if [ -L /usr/bin/playit ]; then
|
|
rm -f /usr/bin/playit
|
|
fi
|
|
|
|
if [ -L /usr/bin/playitd ]; then
|
|
rm -f /usr/bin/playitd
|
|
fi
|
|
|
|
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
|