mirror of
https://github.com/playit-cloud/playit-agent.git
synced 2026-07-04 13:18:40 +00:00
* Adopt nFPM for Linux release packages - Build deb, rpm, apk, archlinux, and ipk artifacts - Update service, socket, and install scripts for the new package layout - Adjust Linux socket permissions for the playit runtime directory * Normalize package input paths in nfpm script - Resolve relative inputs from the start directory - Canonicalize directory portions when possible - Preserve absolute paths unchanged * Install Arch service file under /usr/lib/systemd/system - Update nfpm packaging path for the Arch Linux systemd unit - Keep the service install location aligned with Arch packaging conventions * Handle permission-denied socket inspection on Linux - Fall back to parent directory group checks when socket metadata is unreadable - Reuse playit group access classification for socket and parent paths * Package playitd alongside playit in nfpm builds - Add `/usr/local/bin/playitd` symlink to the package manifest - Create and remove the `playitd` launcher during install and uninstall * Drop IPK packaging and split APK nfpm config - Remove ipk outputs from download and package scripts - Use a dedicated nfpm config for APK packages - Keep shared service install paths on the main config
60 lines
1.3 KiB
Bash
Executable File
60 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
set -eu
|
|
|
|
PLAYIT_USER=playit
|
|
PLAYIT_GROUP=playit
|
|
PLAYIT_HOME=/var/lib/playit
|
|
|
|
have_command() {
|
|
command -v "$1" >/dev/null 2>&1
|
|
}
|
|
|
|
nologin_shell() {
|
|
if [ -x /usr/sbin/nologin ]; then
|
|
printf '%s\n' /usr/sbin/nologin
|
|
elif [ -x /sbin/nologin ]; then
|
|
printf '%s\n' /sbin/nologin
|
|
else
|
|
printf '%s\n' /bin/false
|
|
fi
|
|
}
|
|
|
|
group_exists() {
|
|
if have_command getent; then
|
|
getent group "$PLAYIT_GROUP" >/dev/null 2>&1
|
|
else
|
|
grep -q "^${PLAYIT_GROUP}:" /etc/group 2>/dev/null
|
|
fi
|
|
}
|
|
|
|
user_exists() {
|
|
if have_command id; then
|
|
id -u "$PLAYIT_USER" >/dev/null 2>&1
|
|
else
|
|
grep -q "^${PLAYIT_USER}:" /etc/passwd 2>/dev/null
|
|
fi
|
|
}
|
|
|
|
if ! group_exists; then
|
|
if have_command groupadd; then
|
|
groupadd --system "$PLAYIT_GROUP"
|
|
elif have_command addgroup; then
|
|
addgroup -S "$PLAYIT_GROUP"
|
|
else
|
|
echo "Cannot create ${PLAYIT_GROUP} group: groupadd/addgroup not found" >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if ! user_exists; then
|
|
shell="$(nologin_shell)"
|
|
if have_command useradd; then
|
|
useradd --system --gid "$PLAYIT_GROUP" --home-dir "$PLAYIT_HOME" --no-create-home --shell "$shell" "$PLAYIT_USER"
|
|
elif have_command adduser; then
|
|
adduser -S -D -H -h "$PLAYIT_HOME" -s "$shell" -G "$PLAYIT_GROUP" "$PLAYIT_USER"
|
|
else
|
|
echo "Cannot create ${PLAYIT_USER} user: useradd/adduser not found" >&2
|
|
exit 1
|
|
fi
|
|
fi
|