31 lines
669 B
Bash
31 lines
669 B
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
# Refuse to run without -x
|
|
if [ "$1" != "-x" ]; then
|
|
exit 1
|
|
fi
|
|
|
|
# Upgrade packages & install dependencies
|
|
apk --no-cache update && apk --no-cache upgrade
|
|
apk --no-cache add alpine-sdk bison dns-root-hints expat-dev flex git openssl-dev
|
|
|
|
# Clone Unbound source at given tag
|
|
git clone --depth 1 --branch "release-${UNBOUND_VERSION}" https://github.com/NLnetLabs/unbound.git /tmp/unbound
|
|
cd /tmp/unbound
|
|
|
|
# Build Unbound
|
|
sh configure
|
|
make
|
|
make install
|
|
|
|
# Clean up dependencies
|
|
make clean
|
|
apk --purge del -r alpine-sdk bison expat-dev flex git openssl-dev
|
|
|
|
# Prepare Unbound
|
|
addgroup -S unbound
|
|
adduser -S -G unbound unbound
|
|
mkdir -p /srv/unbound/conf
|