Files
navidrome/release/linux/preinstall.sh
T
Santhi Prakash 375615253f fix(release): skip useradd's /etc/skel copy to prevent SELinux AVC (#6364)
useradd --create-home copies /etc/skel as useradd_t, and SELinux denies
file creation on the var_lib_t target, so installing the RPM on an
enforcing distro logs an AVC for .bash_logout (and the file never lands).

Use --no-create-home and create /var/lib/navidrome with install -d in the
scriptlet context instead. The home dir no longer receives skel files,
which are useless for a system service account.

Fixes #6360

Signed-off-by: Santhi Prakash <b.santhiprakash@gmail.com>
2026-11-24 21:05:57 -05:00

11 lines
495 B
Bash
Executable File

#!/bin/sh
if ! getent passwd navidrome > /dev/null 2>&1; then
printf "Creating default Navidrome user\n"
# SELinux denies useradd's /etc/skel copy into /var/lib (var_lib_t), so
# --create-home logs an AVC on enforcing distros. Create the dir ourselves,
# with the same 0700 mode useradd --create-home would have set.
useradd --home-dir /var/lib/navidrome --no-create-home --system --user-group navidrome
install -d -m 700 -o navidrome -g navidrome /var/lib/navidrome
fi