Add genshin

This commit is contained in:
Alex D. 2024-10-13 18:20:00 +00:00
parent 4979f74631
commit 0760f71a23
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
3 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,36 @@
FROM localhost/caskd/archlinux/base:latest AS data-fetcher
RUN --network=host pacman -Sy --noconfirm \
curl \
jq \
findutils
WORKDIR /run/prepare
RUN --network=host curl -fL 'https://sdk-os-static.mihoyo.com/hk4e_global/mdk/launcher/api/resource?channel_id=1&key=gcStgarh&launcher_id=10' | jq '.data.game.latest' > resource.json
# Downloads retry up to 10 times as the CDN may be unreliable
WORKDIR /run/prepare/game/files
RUN jq -r '.segments[].path' ../../resource.json > ../list
RUN jq -r '.segments[] | "\(.md5) \(.path | split("/") | .[-1])"' ../../resource.json > ../md5sum-list
RUN --network=host cat ../list | xargs -d'\n' curl -C - --retry-all-errors --retry 10 -fZL --remote-name-all --parallel-max 2
RUN md5sum -c ../md5sum-list
WORKDIR /run/prepare/voice/files
RUN jq -r '.voice_packs[] | select(.language == "en-us") | .path' ../../resource.json > ../list
RUN jq -r '.voice_packs[] | select(.language == "en-us") | "\(.md5) \(.path | split("/") | .[-1])"' ../../resource.json > ../md5sum-list
RUN --network=host cat ../list | xargs -d'\n' curl -C - --retry-all-errors --retry 10 -fZL --remote-name-all --parallel-max 2
RUN md5sum -c ../md5sum-list
RUN --network=host pacman -Sy --noconfirm \
p7zip
RUN mkdir -p /run/game
WORKDIR /run/game
RUN find -L /run/prepare/game/files \( -name "*.zip" -o -name "*.zip.001" \) -exec 7z x -aoa -bsp1 '{}' ';'
RUN find -L /run/prepare/voice/files -name "*.zip" -exec 7z x -aoa -bsp1 '{}' ';'
RUN chown -Rv user:user /run/game
FROM scratch
COPY --from=data-fetcher /run/game /

View File

@ -0,0 +1,14 @@
FROM localhost/caskd/archlinux/wine:latest
COPY --from=localhost/caskd/archlinux/genshin/data:latest / /run/game
RUN echo -e \
'0.0.0.0 overseauspider.yuanshen.com\n' \
'0.0.0.0 osuspider.yuanshen.com\n' \
'0.0.0.0 ys-log-upload-os.hoyoverse.com\n' \
'0.0.0.0 sg-public-data-api.hoyoverse.com' >> /etc/hosts
USER user
WORKDIR /home/user
CMD ["wine", "/run/game/GenshinImpact.exe"]

View File

@ -63,8 +63,13 @@ localhost/caskd/archlinux/steam/${BUILD_ID_OUT}: \
localhost/caskd/archlinux/heroic/${BUILD_ID_OUT}: \
$(GRAPHICALDEPS)
# Genshin
localhost/caskd/archlinux/genshin/runtime/${BUILD_ID_OUT}: \
localhost/caskd/archlinux/genshin/data/${BUILD_ID_OUT} \
localhost/caskd/archlinux/wine/${BUILD_ID_OUT}
# Game-data
localhost/caskd/archlinux/genshin/data/${BUILD_ID_OUT}: \
localhost/caskd/archlinux/base/${BUILD_ID_OUT}
# Others