2018-01-30 22:26:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
set -euxo pipefail
|
|
|
|
|
2018-03-04 12:41:25 +00:00
|
|
|
# Install build utilities
|
2020-12-17 10:59:51 +00:00
|
|
|
apk --no-cache add curl jq
|
2018-03-04 12:41:25 +00:00
|
|
|
|
|
|
|
# Install dependencies
|
2020-06-02 12:32:45 +00:00
|
|
|
apk --no-cache add \
|
|
|
|
bind \
|
|
|
|
bind-tools \
|
|
|
|
py3-pip \
|
|
|
|
python3
|
2018-03-04 12:41:25 +00:00
|
|
|
|
2020-12-17 10:59:51 +00:00
|
|
|
# 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
|
2018-03-04 12:41:25 +00:00
|
|
|
|
|
|
|
# Install tools
|
2020-12-17 10:59:51 +00:00
|
|
|
curl -sSfLo /usr/local/bin/dumb-init "${ASSET_URL}"
|
2018-03-04 12:41:25 +00:00
|
|
|
chmod +x /usr/local/bin/dumb-init
|
|
|
|
|
|
|
|
# Install requirements for python3 scripts
|
|
|
|
pip3 install -r /src/requirements.txt
|
|
|
|
|
|
|
|
# Create cron to update zones periodically
|
2019-01-12 16:09:07 +00:00
|
|
|
echo "* * * * * run-parts /etc/periodic/1min" >>/var/spool/cron/crontabs/root
|
2018-03-04 12:41:25 +00:00
|
|
|
mkdir -p /etc/periodic/1min
|
|
|
|
ln -s /src/zonefile_cron /etc/periodic/1min/zonefile_cron
|
|
|
|
|
2019-01-12 16:09:07 +00:00
|
|
|
# Link named.conf
|
|
|
|
ln -sf /src/zones/named.conf /etc/bind/named.conf
|
|
|
|
|
2018-03-04 12:41:25 +00:00
|
|
|
# Cleanup
|
2020-12-17 10:59:51 +00:00
|
|
|
apk --no-cache del curl jq
|