iac/hack/entrypoint.sh

28 lines
804 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/sh
# Точка входа образа с собранными манифестами.
#
# list — что собралось
# cat [префикс] — весь контур (или его часть) одним потоком
# export [путь] — скопировать манифесты в примонтированный каталог
# <команда> — выполнить как есть
set -eu
case "${1:-list}" in
list)
ls -1 /manifests
;;
cat)
shift
cat /manifests/"${1:-}"*.yaml
;;
export)
dst="${2:-/export}"
[ -d "$dst" ] || { echo "Каталог ${dst} не примонтирован" >&2; exit 1; }
cp /manifests/*.yaml "$dst"/
echo "Выгружено в ${dst}"
;;
*)
exec "$@"
;;
esac