setup-vendor.sh (1447B)
1 #!/usr/bin/env bash 2 # Formalize the three upstream sources under vendor/ as pinned git submodules. 3 # 4 # The build only needs the FILES under vendor/{gtfobins,lolbas,wadcoms}; they 5 # are already present (moved in from the working clones, .git preserved), so 6 # `npm run data` works right now without any of this. Run this only when you 7 # want them tracked as proper, re-syncable submodules. 8 # 9 # NOTE: you (the maintainer) drive all VCS. This script is documentation you 10 # can execute; it is never run by the site build or by CI. 11 set -euo pipefail 12 cd "$(dirname "$0")/.." 13 14 pin() { # $1 = path, $2 = url 15 local path="$1" url="$2" sha 16 sha="$(git -C "$path" rev-parse HEAD)" 17 # Adopt the existing checkout as a submodule at its current commit. 18 git submodule add --force "$url" "$path" 19 git -C "$path" checkout --quiet "$sha" 20 echo " pinned $path @ ${sha:0:7}" 21 } 22 23 echo "Registering vendored upstreams as submodules…" 24 pin vendor/gtfobins https://github.com/GTFOBins/GTFOBins.github.io.git 25 pin vendor/lolbas https://github.com/LOLBAS-Project/LOLBAS.git 26 pin vendor/wadcoms https://github.com/WADComs/WADComs.github.io.git 27 git submodule absorbgitdirs || true 28 29 cat <<'NOTE' 30 31 Done. To refresh the dataset against the latest upstreams later: 32 git submodule update --remote vendor/gtfobins vendor/lolbas vendor/wadcoms 33 npm run data # regenerate src/data/techniques.json 34 git add src/data/techniques.json && <commit with jj> 35 NOTE