32 lines
1.0 KiB
Bash
32 lines
1.0 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
# Start D-Bus
|
||
|
mkdir -p /var/run/dbus
|
||
|
dbus-daemon --system --fork
|
||
|
|
||
|
# Start SSH
|
||
|
/usr/sbin/sshd
|
||
|
|
||
|
# Start Xvfb
|
||
|
Xvfb :1 -screen 0 1024x768x16 &
|
||
|
|
||
|
# Start VNC server
|
||
|
vncserver :1 -geometry 1024x768 -depth 16 -SecurityTypes None
|
||
|
|
||
|
# Start PulseAudio
|
||
|
su - $USER_NAME -c "pulseaudio --start -D --verbose"
|
||
|
|
||
|
# Set up virtual audio output
|
||
|
su - $USER_NAME -c "pactl unload-module module-null-sink || true"
|
||
|
su - $USER_NAME -c "pactl unload-module module-pipe-sink || true"
|
||
|
su - $USER_NAME -c "pactl load-module module-virtual-sink sink_name=virtual_output"
|
||
|
su - $USER_NAME -c "pactl set-default-sink virtual_output"
|
||
|
|
||
|
# Ensure all audio streams are moved to the virtual_output
|
||
|
su - $USER_NAME -c "pactl list short sink-inputs | cut -f1 | while read stream; do pactl move-sink-input \$stream virtual_output; done"
|
||
|
|
||
|
# Start audio streaming
|
||
|
su - $USER_NAME -c "gst-launch-1.0 pulsesrc device=virtual_output.monitor ! audioconvert ! opusenc ! rtpopuspay ! udpsink host=host.docker.internal port=5000 &"
|
||
|
|
||
|
# Keep the container running
|
||
|
tail -f /dev/null
|