#!/bin/bash
# L4D2 Competitive Rework overlay.
# Pulls the master branch of SirPlease/L4D2-Competitive-Rework as a tarball
# and extracts it into $OVERLAY/left4dead2/. Skipped on subsequent rebuilds
# once cfg/cfgogl/ is present — wipe the overlay to force a refresh.
# https://github.com/SirPlease/L4D2-Competitive-Rework
set -xeuo pipefail

DEST="$OVERLAY/left4dead2"
mkdir -p "$DEST"

if [[ ! -d "$DEST/cfg/cfgogl" ]]; then
    curl -fsSL https://github.com/SirPlease/L4D2-Competitive-Rework/archive/refs/heads/master.tar.gz \
        | tar -xz --strip-components=1 -C "$DEST"
fi
