From 6f641bbd97ad927bda8123a0a317b4e0ade0ed3b Mon Sep 17 00:00:00 2001 From: Simon Bruder Date: Wed, 10 Jun 2020 16:33:29 +0200 Subject: [PATCH] Add run script and readme --- README.md | 19 +++++++++++++++++++ run.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 README.md create mode 100755 run.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..20ffb1d --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# *osu!lazer* in docker + +## How to use + +Place `run.sh` in a directory of your choice. On first run, the directories +`data` and `import` will be created. + +To import a beatmap, place it in the `import` directory, open a graphical file +manager and drag-and-drop the file into *osu!*. + +## Known Bugs + + * *osu!* shows `Couldn’t list input devices. Is libasound2-dev installed?` at + startup. Fixing this requires installing `libasound2-dev` in the runtime + container and mounting `/dev/snd` in the container. This is not done as this + container is intended to be used with PulseAudio (which works). + +This is not an official product by ppy Pty Ltd. *osu!* is a registered +trademark by ppy Pty Ltd. diff --git a/run.sh b/run.sh new file mode 100755 index 0000000..e4b477c --- /dev/null +++ b/run.sh @@ -0,0 +1,33 @@ +#!/bin/bash +function set_latency_offset() { + if [ $# != 1 ]; then + return 1 + fi + echo "Set latency offset to $1 µs" >&2 + pactl set-port-latency-offset alsa_card.pci-0000_00_1b.0 analog-output-headphones $1 +} + +set_latency_offset -40000 +trap "set_latency_offset 0" SIGINT SIGTERM EXIT + +BASEDIR="$(dirname $(realpath -s $0))" + +mkdir -p "$BASEDIR/data" "$BASEDIR/import" + +docker run \ + --rm \ + -it \ + --name osu \ + -e DISPLAY \ + -e PULSE_SERVER=/run/user/$(id -u)/pulse/native \ + -e PULSE_COOKIE=/run/pulse/cookie \ + --device /dev/dri \ + --group-add $(getent group video|cut -d: -f3) \ + --group-add $(getent group audio|cut -d: -f3) \ + -v /tmp/.X11-unix:/tmp/.X11-unix \ + -v /run/user/$(id -u)/pulse/native:/run/user/$(id -u)/pulse/native \ + -v "$HOME/.config/pulse/cookie:/run/pulse/cookie" \ + -v "$BASEDIR/data/:/home/osu/osu/" \ + -v "$BASEDIR/import/:$BASEDIR/import/" \ + r.sbruder.de/osu \ + $@