cdist-contrib/type/__bird_static/files/template.sh

26 lines
563 B
Bash
Raw Normal View History

2021-04-19 12:06:47 +00:00
#!/bin/sh
# Template to generate a static protocol configuration file for bird(1).
# Required non-empty variables:
# __object_id, object
#
# Required defined variables:
# description
# Header
printf "protocol static %s {\n" "${__object_id:?}"
# Optional description
[ -n "${description?}" ] && printf "\tdescription \"%s\";\n" "${description:?}"
# Channel choice
2021-05-12 10:32:39 +00:00
printf "\t%s;\n" "$(cat "${__object:?}/parameter/channel")"
2021-04-19 12:06:47 +00:00
# Routes
while read -r route
do
printf "\troute %s;\n" "${route?}"
done < "${__object:?}/parameter/route"
# Header close
printf "}\n"