Added more tests
This commit is contained in:
@@ -4,18 +4,37 @@
|
||||
# ============================================================================
|
||||
# PipeWire audio server + WirePlumber session manager.
|
||||
# NOTE: PipeWire is designed to run as a user service, not system-wide.
|
||||
# This script starts it for the auto-login user (danny) on tty1.
|
||||
# For the system-level boot, we just ensure the prerequisites are ready.
|
||||
# The actual PipeWire startup is handled in the user's shell profile.
|
||||
# This script prepares the runtime directory for the auto-login user.
|
||||
# The actual PipeWire startup is handled in the user's shell profile
|
||||
# (~/.zprofile) which starts pipewire, pipewire-pulse, and wireplumber.
|
||||
#
|
||||
# The auto-login user is detected from /etc/inittab (--autologin <user>).
|
||||
# ============================================================================
|
||||
|
||||
# Source system configuration
|
||||
[ -f /etc/rc.conf ] && . /etc/rc.conf
|
||||
|
||||
# Detect the auto-login user from inittab
|
||||
get_autologin_user() {
|
||||
local user
|
||||
user=$(grep -m1 -- '--autologin' /etc/inittab 2>/dev/null \
|
||||
| sed 's/.*--autologin \([^ ]*\).*/\1/')
|
||||
echo "${user:-root}"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo " PipeWire: ready (will start with user session)"
|
||||
# Ensure runtime directory exists for the user
|
||||
mkdir -p /run/user/1000
|
||||
chown danny:danny /run/user/1000
|
||||
chmod 700 /run/user/1000
|
||||
AUTOLOGIN_USER=$(get_autologin_user)
|
||||
AUTOLOGIN_UID=$(id -u "$AUTOLOGIN_USER" 2>/dev/null || echo 1000)
|
||||
|
||||
echo " PipeWire: preparing runtime dir for ${AUTOLOGIN_USER} (uid ${AUTOLOGIN_UID})"
|
||||
|
||||
# Ensure XDG_RUNTIME_DIR exists for the user session
|
||||
mkdir -p "/run/user/${AUTOLOGIN_UID}"
|
||||
chown "${AUTOLOGIN_USER}:${AUTOLOGIN_USER}" "/run/user/${AUTOLOGIN_UID}"
|
||||
chmod 700 "/run/user/${AUTOLOGIN_UID}"
|
||||
|
||||
echo " PipeWire: ready (will start with user session on tty1)"
|
||||
;;
|
||||
stop)
|
||||
echo " Stopping PipeWire..."
|
||||
|
||||
Reference in New Issue
Block a user