Added git support

This commit is contained in:
RallyBlock
2026-03-20 22:19:28 -07:00
parent 909a1a5764
commit d59d652fdd
3 changed files with 36 additions and 0 deletions
+30
View File
@@ -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