From d59d652fdd3562653485ecadf82cd6a7f20b545c Mon Sep 17 00:00:00 2001 From: RallyBlock <50393307+RallyBlock@users.noreply.github.com> Date: Fri, 20 Mar 2026 22:19:28 -0700 Subject: [PATCH] Added git support --- Dockerfile | 4 ++++ README.md | 2 ++ bin/run-bl | 30 ++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+) diff --git a/Dockerfile b/Dockerfile index b2e0984..bea2cec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,7 @@ RUN chmod +x /tini \ wine-${WINE_FLAVOUR}-amd64=${WINE_VERSION} \ wine-${WINE_FLAVOUR}-i386=${WINE_VERSION} \ unzip \ + git \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* @@ -58,6 +59,9 @@ ENV BL_DEDI_LAN=0 \ BL_INST_NUM_PROC=10 \ BL_INST_FORCE=0 \ BL_INST_OVERWRITE=0 \ + BL_UNZIP_ADDONS=0 \ + BL_ADDON_REPO="" \ + BL_ADDON_REPO_BRANCH="" \ BL_PATCH_ENABLE=1 \ BL_PATCH_EXE_URL=https://gitlab.com/-/project/19166101/uploads/7e9bc075056c3301fd1247975ecaa218/Blockland.exe \ BL_PATCH_LOADER_URL=https://gitlab.com/-/project/19166101/uploads/2970aa2d8c23259f8becb0f49630efcc/RedBlocklandLoader.dll \ diff --git a/README.md b/README.md index 297d42e..dc9bc43 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ The image is available on Docker Hub at [rallyblockk/blockland-pelican](https:// | BL_INST_FORCE | bool (0 or 1) | 0 | Forcefully install the game each time you launch | BL_INST_OVERWRITE | bool (0 or 1) | 0 | Overwrite existing files during installation | BL_UNZIP_ADDONS | bool (0 or 1) | 0 | When enabled, automatically extracts any .zip files in the Add-Ons directory before the server starts. Each zip is unzipped and the archive is removed. Handles single-folder, single-file, and multi-file zip structures so add-ons end up in properly named folders. +| BL_ADDON_REPO | string | "" | Git repository URL to clone into the Add-Ons folder on server start. Only runs on container boot (server reboot). If already cloned, fetches and pulls only when the remote has new commits. +| BL_ADDON_REPO_BRANCH | string | "" | Optional. Branch to clone and track when using BL_ADDON_REPO. Leave empty to use the repository's default branch. | BL_PATCH_ENABLE | bool (0 or 1) | 1 | Patches the game with RedBlocklandLoader and the WineFix DLL to make the console work with Wine 8.0.2 (See Wine section below) | BL_PATCH_EXE_URL | string | See Dockerfile | URL to retrieve the patched Blockland.exe from for RedBlocklandLoader | BL_PATCH_LOADER_URL | string | See Dockerfile | URL to retrieve RedBlocklandLoader.dll from diff --git a/bin/run-bl b/bin/run-bl index 5bb309d..1151fe7 100644 --- a/bin/run-bl +++ b/bin/run-bl @@ -71,6 +71,36 @@ if [ "${BL_UNZIP_ADDONS:-0}" -eq 1 ]; then done fi +# Sync Add-On from git repository if BL_ADDON_REPO is set (only on reboot; only pulls when remote has updates) +if [ -n "$BL_ADDON_REPO" ]; then + echo "Syncing Add-On from git repository..." + + mkdir -p /home/container/Add-Ons + cd /home/container/Add-Ons + + repo_name=$(basename "$BL_ADDON_REPO" .git) + + if [ -d "$repo_name/.git" ]; then + cd "$repo_name" + git fetch origin + upstream=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2>/dev/null) + behind=$(git rev-list HEAD.."${upstream:-origin/HEAD}" --count 2>/dev/null || echo 0) + if [ "${behind:-0}" -gt 0 ]; then + echo "Add-On has updates, pulling..." + git pull --ff-only + else + echo "Add-On is up to date." + fi + cd /home/container/Add-Ons + else + clone_opts=() + [ -n "$BL_ADDON_REPO_BRANCH" ] && clone_opts=(-b "$BL_ADDON_REPO_BRANCH") + git clone "${clone_opts[@]}" "$BL_ADDON_REPO" + fi + + cd /home/container || exit 1 +fi + # Ensure we're in the correct directory (server root where Blockland.exe lives) cd /home/container || exit 1