scripts/sbom.sh 976 B 30 lines Raw
1 #!/bin/sh2 # Generate the offline SBOM and third-party notices from the locked crates.3 # The vendor tree is a release input, not a committed dependency: generate it4 # from the lockfile, use it for the licence texts, and keep it out of the5 # public snapshot.6 set -eu7 8 root=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)9 out=${1:-$root/target/sbom}10 allow=${HU13_LICENSE_ALLOW:-Apache-2.0/MIT}11 12 hu13=${HU13_BIN:-}13 if [ -z "$hu13" ]; then14     hu13=$(command -v hu13 2>/dev/null || true)15 fi16 if [ -z "$hu13" ] && [ -x "$root/../hu13/target/release/hu13" ]; then17     hu13=$root/../hu13/target/release/hu1318 fi19 [ -n "$hu13" ] || {20     printf 'sbom: set HU13_BIN or put hu13 on PATH\n' >&221     exit 222 }23 24 if [ ! -d "$root/vendor" ] || [ ! -f "$root/vendor/.inf3r-license-metadata" ]; then25     (cd "$root" && cargo vendor --locked vendor >/dev/null)26 fi27 28 rm -rf "$out"29 "$hu13" sbom "$root" --out "$out" --strict --license-allow "$allow" >/dev/null30 printf 'sbom: %s\n' "$out/api/sbom.json"