mirror of
https://github.com/Sea-Haven-Industries/seahaven-door-unlock-api.git
synced 2026-09-30 04:53:10 +00:00
26 lines
666 B
Bash
26 lines
666 B
Bash
|
|
#!/usr/bin/env bash
|
||
|
|
# Terraform external data source entrypoint. Stdout must be JSON only.
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
ROOT="$(cd "$(dirname "$0")" && pwd)"
|
||
|
|
# artifacts.tf already launches this file with bash, so +x is not required
|
||
|
|
# here. Invoke the inner script the same way so HCP plan does not depend on
|
||
|
|
# the git executable bit.
|
||
|
|
bash "${ROOT}/build_packages.sh" >&2
|
||
|
|
|
||
|
|
if command -v sha256sum >/dev/null 2>&1; then
|
||
|
|
SHA=(sha256sum)
|
||
|
|
else
|
||
|
|
SHA=(shasum -a 256)
|
||
|
|
fi
|
||
|
|
|
||
|
|
hash="$(
|
||
|
|
{
|
||
|
|
find -P "${ROOT}/build" -type f -print0 2>/dev/null \
|
||
|
|
| sort -z \
|
||
|
|
| xargs -0 "${SHA[@]}"
|
||
|
|
} | "${SHA[@]}" | awk '{print $1}'
|
||
|
|
)"
|
||
|
|
|
||
|
|
printf '{"status":"ok","hash":"%s"}\n' "${hash}"
|