diff --git a/localhost/caskd/archlinux/genshin/data/Containerfile b/localhost/caskd/archlinux/genshin/data/Containerfile new file mode 100644 index 0000000..7d4de22 --- /dev/null +++ b/localhost/caskd/archlinux/genshin/data/Containerfile @@ -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 / diff --git a/localhost/caskd/archlinux/genshin/runtime/Containerfile b/localhost/caskd/archlinux/genshin/runtime/Containerfile new file mode 100644 index 0000000..2cc8b3c --- /dev/null +++ b/localhost/caskd/archlinux/genshin/runtime/Containerfile @@ -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"] diff --git a/localhost/config.mk b/localhost/config.mk index 291cde8..e30a22f 100644 --- a/localhost/config.mk +++ b/localhost/config.mk @@ -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