projects/aports·blob master · refs

31 lines · 973 B

1#!/bin/sh
2
3cat >&2 <<EOF
4*
5* This script will be removed in the future to replace it with OpenRC user-services.
6*
7EOF
8
9# Exit if the service is already running through user services
10rc-service --user pipewire status 1>/dev/null 2>&1 && exit 0
11
12# We need to kill any existing pipewire instance to restore sound
13pkill -u "${USER}" -fx /usr/bin/pipewire-pulse 1>/dev/null 2>&1
14pkill -u "${USER}" -fx /usr/bin/pipewire-media-session 1>/dev/null 2>&1
15pkill -u "${USER}" -fx /usr/bin/wireplumber 1>/dev/null 2>&1
16pkill -u "${USER}" -fx /usr/bin/pipewire 1>/dev/null 2>&1
17
18exec /usr/bin/pipewire &
19
20# wait for pipewire to start before attempting to start related daemons
21while [ "$(pgrep -f /usr/bin/pipewire)" = "" ]; do
22 sleep 1
23done
24
25if [ -x /usr/bin/wireplumber ]; then
26 exec /usr/bin/wireplumber &
27elif [ -x /usr/bin/pipewire-media-session ]; then
28 exec /usr/bin/pipewire-media-session &
29fi
30
31[ -f "/usr/share/pipewire/pipewire-pulse.conf" ] && exec /usr/bin/pipewire-pulse &