forked from selkies-project/docker-nvidia-egl-desktop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
selkies-gstreamer-entrypoint.sh
executable file
·47 lines (38 loc) · 1.42 KB
/
selkies-gstreamer-entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash -e
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Source environment for GStreamer
source /opt/gstreamer/gst-env
# Set default display
export DISPLAY="${DISPLAY:-:0}"
# Configure joystick interposer
sudo mkdir -pm755 /dev/input
sudo touch /dev/input/{js0,js1,js2,js3}
# Show debug logs for GStreamer
export GST_DEBUG="${GST_DEBUG:-*:2}"
# Set password for basic authentication
if [ "${ENABLE_BASIC_AUTH,,}" = "true" ] && [ -z "$BASIC_AUTH_PASSWORD" ]; then export BASIC_AUTH_PASSWORD="$PASSWD"; fi
# Wait for X11 to start
echo "Waiting for X socket"
until [ -S "/tmp/.X11-unix/X${DISPLAY/:/}" ]; do sleep 1; done
echo "X socket is ready"
# Write Progressive Web App (PWA) configuration
export PWA_APP_NAME="Selkies WebRTC"
export PWA_APP_SHORT_NAME="selkies"
export PWA_START_URL="/index.html"
sudo sed -i \
-e "s|PWA_APP_NAME|${PWA_APP_NAME}|g" \
-e "s|PWA_APP_SHORT_NAME|${PWA_APP_SHORT_NAME}|g" \
-e "s|PWA_START_URL|${PWA_START_URL}|g" \
/opt/gst-web/manifest.json && \
sudo sed -i \
-e "s|PWA_CACHE|${PWA_APP_SHORT_NAME}-webrtc-pwa|g" \
/opt/gst-web/sw.js
# Clear the cache registry
rm -rf "${HOME}/.cache/gstreamer-1.0"
# Start the selkies-gstreamer WebRTC HTML5 remote desktop application
selkies-gstreamer \
--addr="0.0.0.0" \
--port="8080" \
$@