Compare commits

...

10 commits

Author SHA1 Message Date
Simon Bruder 5eafc8f24b
Remove drone pipeline 2024-05-09 02:38:40 +02:00
Simon Bruder 4cf2e90105
README: Remove docker name 2024-05-09 02:37:22 +02:00
Simon Bruder d427a16616
README: Remove irrelevant bug 2024-05-09 02:35:52 +02:00
Simon Bruder ae71bdeeed
run.sh: Update to podman and new image 2024-05-09 02:35:21 +02:00
Simon Bruder 5c9b35ba77
Fix warnings in osu client 2024-05-09 02:34:50 +02:00
Simon Bruder 3ed6442b49
Update 3rd party rulesets
Some did not build and were removed. This change also makes building
much faster, as the build now caches NuGet packages and uses one stage
per ruleset, so they can be built in parallel (by passing `--jobs N`).
2024-05-09 02:34:30 +02:00
Simon Bruder 11957cddba
Make version explicit 2024-05-09 02:31:02 +02:00
Simon Bruder 34a77be7d7
Remove patches 2024-05-09 02:28:56 +02:00
Simon Bruder c0511109ad
Use dotnet SDK 8.0 base image 2024-05-09 02:27:53 +02:00
Simon Bruder 855a0d121a
run.sh: Remove latency offset
It was hardcoded to nunotaba and should rather be set outside of the
script (and with other methods).
2024-05-09 02:25:16 +02:00
6 changed files with 70 additions and 86 deletions

View file

@ -1,13 +0,0 @@
kind: pipeline
name: default
steps:
- name: docker
image: plugins/docker
settings:
registry: r.sbruder.de
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: r.sbruder.de/osu

View file

@ -1,20 +1,17 @@
FROM mcr.microsoft.com/dotnet/core/sdk as builder
# Builder for base osu!
FROM mcr.microsoft.com/dotnet/sdk:8.0 as builder
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
RUN apt-get update \
&& apt-get -y install jq
COPY disable-deployed-build.patch /tmp/
ARG OSU_VERSION
ENV OSU_VERSION=$OSU_VERSION
ARG CACHEBUST=1
ENV CACHEBUST=$CACHEBUST
RUN OSU_VERSION=$(curl -s https://api.github.com/repos/ppy/osu/releases/latest | jq -r .tag_name) \
RUN --mount=type=cache,target=/root/.nuget/packages --mount=type=cache,target=/root/.local/share/NuGet/http-cache echo "Downloading and building osu! ${OSU_VERSION}" >&2 \
&& git clone --depth=1 --single-branch -b ${OSU_VERSION} https://github.com/ppy/osu \
&& cd osu \
&& curl https://raw.githubusercontent.com/NixOS/nixpkgs/master/pkgs/games/osu-lazer/bypass-tamper-detection.patch | git apply \
&& git apply /tmp/disable-deployed-build.patch \
&& dotnet publish \
-c Release \
-r linux-x64 \
@ -23,29 +20,27 @@ RUN OSU_VERSION=$(curl -s https://api.github.com/repos/ppy/osu/releases/latest |
-p:Version=${OSU_VERSION} \
osu.Desktop
RUN for ruleset in \
"Bosu|https://github.com/EVAST9919/bosu" \
"Hitokori|https://github.com/Flutterish/Hitokori" \
"Karaoke|https://github.com/karaoke-dev/karaoke" \
"Mvis|https://github.com/EVAST9919/lazer-m-vis" \
"Rush|https://github.com/swoolcock/rush" \
"Sentakki|https://github.com/LumpBloom7/sentakki" \
"Swing|https://github.com/EVAST9919/lazer-swing" \
"Tau|https://github.com/Altenhh/tau" \
; do \
repo_url="$(echo $ruleset | cut -d'|' -f2)" \
&& assembly_name="osu.Game.Rulesets.$(echo $ruleset | cut -d'|' -f1)" \
&& git clone --depth=1 "$repo_url" ruleset \
&& cd ruleset \
&& dotnet build \
-c Release \
"$assembly_name" \
&& cp "${assembly_name}"/bin/Release/net*/"${assembly_name}".dll /opt/osu/ \
&& cd .. \
&& rm -rf ruleset \
; done
# Generic builder for rulesets (using onbuild and args)
FROM mcr.microsoft.com/dotnet/sdk:8.0 as builder-ruleset-generic
FROM mcr.microsoft.com/dotnet/core/runtime
COPY ./build-ruleset.sh /usr/local/bin/build-ruleset
FROM builder-ruleset-generic as builder-swing
RUN --mount=type=cache,target=/root/.nuget/packages --mount=type=cache,target=/root/.local/share/NuGet/http-cache build-ruleset https://github.com/EVAST9919/lazer-swing
FROM builder-ruleset-generic as builder-tau
RUN --mount=type=cache,target=/root/.nuget/packages --mount=type=cache,target=/root/.local/share/NuGet/http-cache build-ruleset https://github.com/Altenhh/tau
FROM builder-ruleset-generic as builder-bosu
RUN --mount=type=cache,target=/root/.nuget/packages --mount=type=cache,target=/root/.local/share/NuGet/http-cache build-ruleset https://github.com/EVAST9919/bosu
FROM builder-ruleset-generic as builder-rush
RUN --mount=type=cache,target=/root/.nuget/packages --mount=type=cache,target=/root/.local/share/NuGet/http-cache build-ruleset https://github.com/swoolcock/rush
FROM builder-ruleset-generic as builder-sentakki
RUN --mount=type=cache,target=/root/.nuget/packages --mount=type=cache,target=/root/.local/share/NuGet/http-cache build-ruleset https://github.com/LumpBloom7/sentakki
FROM mcr.microsoft.com/dotnet/runtime:8.0
RUN apt-get update \
&& apt-get -y install --no-install-recommends \
@ -54,11 +49,21 @@ RUN apt-get update \
libgbm1 \
libgl1 \
pulseaudio \
xdg-utils \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /opt/osu/ /opt/osu/
COPY --from=builder-swing /dlls/*.dll /opt/osu/
COPY --from=builder-tau /dlls/*.dll /opt/osu/
COPY --from=builder-bosu /dlls/*.dll /opt/osu/
COPY --from=builder-rush /dlls/*.dll /opt/osu/
COPY --from=builder-sentakki /dlls/*.dll /opt/osu/
RUN adduser --disabled-password --gecos '' osu
USER osu
WORKDIR /home/osu
RUN mkdir -p .local/share/applications
ENTRYPOINT ["/opt/osu/osu!"]

View file

@ -1,19 +1,24 @@
# *osu!lazer* in docker
# *osu!lazer* in OCI container
## How to use
### Building
Using podman/buildah:
buildah build --format docker --layers -t osu --build-arg OSU_VERSION=2024.412.1 --jobs 0
Change `2024.412.1` to the newest osu! version.
By changing `--jobs 0` to a positive integer N,
at most N build stages will be run in parallel.
### Running
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 `Couldnt 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).
<small>This is not an official product by ppy Pty Ltd. *osu!* is a registered
trademark by ppy Pty Ltd.</small>

18
build-ruleset.sh Executable file
View file

@ -0,0 +1,18 @@
#!/usr/bin/env bash
set -euo pipefail
RULESET_URL="$1"
git clone --depth=1 "${RULESET_URL}" ruleset
pushd ruleset
ASSEMBLY_NAME="$(basename "$(find . -iname '*.sln' -printf '%f\n' | head -n1)" .sln)"
dotnet build -c Release ${ASSEMBLY_NAME}
case "${ASSEMBLY_NAME}" in
# special build steps can be put here
*)
mkdir /dlls
mv ${ASSEMBLY_NAME}/bin/Release/net*/${ASSEMBLY_NAME}.dll /dlls/
;;
esac
popd
rm -rf ruleset

View file

@ -1,21 +0,0 @@
diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs
index b1269e9..efeefa6 100644
--- a/osu.Game/OsuGameBase.cs
+++ b/osu.Game/OsuGameBase.cs
@@ -109,15 +109,12 @@ public class OsuGameBase : Framework.Game, ICanAcceptFiles
/// </summary>
public string VersionHash { get; private set; }
- public bool IsDeployedBuild => AssemblyVersion.Major > 0;
+ public bool IsDeployedBuild => false;
public virtual string Version
{
get
{
- if (!IsDeployedBuild)
- return @"local " + (DebugUtils.IsDebugBuild ? @"debug" : @"release");
-
var version = AssemblyVersion;
return $@"{version.Major}.{version.Minor}.{version.Build}";
}

18
run.sh
View file

@ -1,23 +1,13 @@
#!/usr/bin/env 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 "$HOME/.local/share/osu" "$BASEDIR/import"
docker run \
podman run \
--rm \
-it \
--name osu \
--userns="keep-id:uid=$(id -u),gid=$(id -g)" \
--device /dev/dri \
--group-add $(getent group audio|cut -d: -f3) \
--group-add $(getent group video|cut -d: -f3) \
@ -25,9 +15,9 @@ docker run \
-e PULSE_SERVER=/run/user/$(id -u)/pulse/native \
-e WAYLAND_DISPLAY \
-e XDG_RUNTIME_DIR \
-v "$HOME/.local/share/osu/:/home/osu/osu/" \
-v "$HOME/.local/share/osu/:/home/osu/.local/share/osu/" \
-v "$BASEDIR/import/:$BASEDIR/import/" \
-v "$HOME/.config/pulse/cookie:/run/pulse/cookie" \
-v "${XDG_RUNTIME_DIR}:${XDG_RUNTIME_DIR}" \
r.sbruder.de/osu \
osu \
$@