Compare commits

..

No commits in common. "5eafc8f24b10eeacc7c5bfbcb8c42145b2e357bc" and "e307f5a75c351dcc6745fdd3c0f6d47131734c61" have entirely different histories.

6 changed files with 86 additions and 70 deletions

13
.drone.yml Normal file
View file

@ -0,0 +1,13 @@
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,17 +1,20 @@
# Builder for base osu!
FROM mcr.microsoft.com/dotnet/sdk:8.0 as builder
FROM mcr.microsoft.com/dotnet/core/sdk as builder
ENV DOTNET_CLI_TELEMETRY_OPTOUT 1
RUN apt-get update \
&& apt-get -y install jq
ARG OSU_VERSION
ENV OSU_VERSION=$OSU_VERSION
COPY disable-deployed-build.patch /tmp/
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 \
ARG CACHEBUST=1
ENV CACHEBUST=$CACHEBUST
RUN OSU_VERSION=$(curl -s https://api.github.com/repos/ppy/osu/releases/latest | jq -r .tag_name) \
&& 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 \
@ -20,27 +23,29 @@ RUN --mount=type=cache,target=/root/.nuget/packages --mount=type=cache,target=/r
-p:Version=${OSU_VERSION} \
osu.Desktop
# Generic builder for rulesets (using onbuild and args)
FROM mcr.microsoft.com/dotnet/sdk:8.0 as builder-ruleset-generic
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
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
FROM mcr.microsoft.com/dotnet/core/runtime
RUN apt-get update \
&& apt-get -y install --no-install-recommends \
@ -49,21 +54,11 @@ 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,24 +1,19 @@
# *osu!lazer* in OCI container
# *osu!lazer* in docker
## 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>

View file

@ -1,18 +0,0 @@
#!/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

@ -0,0 +1,21 @@
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,13 +1,23 @@
#!/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"
podman run \
docker 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) \
@ -15,9 +25,9 @@ podman run \
-e PULSE_SERVER=/run/user/$(id -u)/pulse/native \
-e WAYLAND_DISPLAY \
-e XDG_RUNTIME_DIR \
-v "$HOME/.local/share/osu/:/home/osu/.local/share/osu/" \
-v "$HOME/.local/share/osu/:/home/osu/osu/" \
-v "$BASEDIR/import/:$BASEDIR/import/" \
-v "$HOME/.config/pulse/cookie:/run/pulse/cookie" \
-v "${XDG_RUNTIME_DIR}:${XDG_RUNTIME_DIR}" \
osu \
r.sbruder.de/osu \
$@