1
0
Fork 0
mirror of https://github.com/Luzifer/dns.git synced 2024-11-09 14:40:05 +00:00
dns/build.sh
Knut Ahlers ee8fcd74f5
Switch to Github API for release query
Signed-off-by: Knut Ahlers <knut@ahlers.me>
2020-12-17 12:02:06 +01:00

38 lines
937 B
Bash
Executable file

#!/bin/bash
set -euxo pipefail
# Install build utilities
apk --no-cache add curl jq
# Install dependencies
apk --no-cache add \
bind \
bind-tools \
py3-pip \
python3
# Get latest versions of tools using Github API
ASSET_URL=$(
curl -s "https://api.github.com/repos/Yelp/dumb-init/releases/latest" |
jq -r '.assets[] | .browser_download_url' |
grep "$(uname -m)$"
)
[[ -n $ASSET_URL ]] || exit 1
# Install tools
curl -sSfLo /usr/local/bin/dumb-init "${ASSET_URL}"
chmod +x /usr/local/bin/dumb-init
# Install requirements for python3 scripts
pip3 install -r /src/requirements.txt
# Create cron to update zones periodically
echo "* * * * * run-parts /etc/periodic/1min" >>/var/spool/cron/crontabs/root
mkdir -p /etc/periodic/1min
ln -s /src/zonefile_cron /etc/periodic/1min/zonefile_cron
# Link named.conf
ln -sf /src/zones/named.conf /etc/bind/named.conf
# Cleanup
apk --no-cache del curl jq