miniRT/scripts/run_vnc.sh

50 lines
812 B
Bash
Executable File

#!/bin/bash
NOVNC=""
XVNC=Xvnc
XVNC_HOST=0.0.0.0
XVNC_PORT=5901
DISPLAY_WIDTH=$1
DISPLAY_HEIGHT=$2
print_usage() {
echo "Usage: run_vnc.sh <width> <height>"
}
if command -v novnc_proxy &> /dev/null; then
NOVNC=novnc_proxy
elif command -v novnc &> /dev/null; then
NOVNC=novnc
else
echo "noVNC (novnc_proxy || novnc) not found! Aborting..."
exit 1
fi
if ! command -v Xvnc &> /dev/null; then
echo "Xvnc not found! Aborting..."
exit 1
fi
if [[ "$DISPLAY_WIDTH" = "" || "$DISPLAY_HEIGHT" = "" ]] ; then
print_usage
exit 1
fi
$XVNC :1 \
-geometry ${DISPLAY_WIDTH}x${DISPLAY_HEIGHT} \
-depth 24 \
-SecurityTypes None \
-interface $XVNC_HOST \
-rfbport $XVNC_PORT &
sleep 2
$NOVNC --vnc localhost:${XVNC_PORT} &
sleep 2
export DISPLAY=:1
exec ./miniRT