#!/bin/sh set -eu : "${GAMEPLAY_DISPLAY:=:98}" : "${GAMEPLAY_WIDTH:=1280}" : "${GAMEPLAY_HEIGHT:=720}" : "${OSU_EXE:=/data/osu/osu!.exe}" : "${TOSU_BIN:=/data/tosu/tosu}" if [ ! -f "$OSU_EXE" ]; then echo "Missing $OSU_EXE. Mount a dedicated osu! stable installation at /data/osu." >&2 exit 1 fi Xvfb "$GAMEPLAY_DISPLAY" -screen 0 "${GAMEPLAY_WIDTH}x$((GAMEPLAY_HEIGHT + 220))x24" -nolisten tcp & export DISPLAY="$GAMEPLAY_DISPLAY" sleep 2 if [ -n "${VNC_PASSWORD:-}" ]; then x11vnc -storepasswd "$VNC_PASSWORD" /tmp/vash-vnc.pass >/dev/null x11vnc -display "$GAMEPLAY_DISPLAY" -rfbauth /tmp/vash-vnc.pass -rfbport 5900 -forever -shared -quiet & websockify --web=/usr/share/novnc 0.0.0.0:6080 127.0.0.1:5900 & fi pulseaudio --start --exit-idle-time=-1 pactl load-module module-null-sink sink_name=vash >/dev/null export PULSE_SINK=vash # On first use, run osu! normally in the VNC screen, sign in with Remember # Username/Password, then restart without OSU_SETUP. The agent writes # tournament.cfg only after this setup run has ended. if [ "${OSU_SETUP:-0}" = 1 ]; then if [ -f "$(dirname "$OSU_EXE")/tournament.cfg" ]; then echo "OSU_SETUP needs a fresh installation without tournament.cfg." >&2 exit 1 fi if [ "${OSU_DOTNET:-0}" = 1 ]; then winetricks -q dotnet48 fi cd "$(dirname "$OSU_EXE")" exec wine "$OSU_EXE" fi if [ ! -x "$TOSU_BIN" ]; then echo "Missing executable $TOSU_BIN. Mount the tosu Linux build at /data/tosu/tosu." >&2 exit 1 fi if [ -z "${VASH_SERVER:-}" ] || [ -z "${VASH_CHANNEL:-}" ] || [ -z "${VASH_TOKEN:-}" ]; then echo "Set VASH_SERVER, VASH_CHANNEL and VASH_TOKEN." >&2 exit 1 fi export TOSU_OSU_PATH="$(dirname "$OSU_EXE")" ( while :; do "$TOSU_BIN" || true echo "tosu stopped; restarting in 3 seconds" >&2 sleep 3 done ) & ( while :; do AUTO_JOIN=1 vash-agent --server "$VASH_SERVER" --channel "$VASH_CHANNEL" --token "$VASH_TOKEN" --osu-exe "$OSU_EXE" --auto-join || true echo "Vash agent stopped; restarting in 3 seconds" >&2 sleep 3 done ) & exec vash-tv