Skip to content

Commit

Permalink
feat(coredns): add install_coredns
Browse files Browse the repository at this point in the history
add install_coredns

Signed-off-by: mritd <[email protected]>
  • Loading branch information
mritd committed Mar 30, 2020
1 parent 8f62940 commit 9a9d39a
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions install_coredns.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/bin/bash

set -e

VERSION="${1}"

if [ -z "${VERSION}" ]; then
VERSION="1.6.4"
echo "No CoreDNS version specified, use default version: 1.6.4!"
VERSION="1.6.9"
echo "No CoreDNS version specified, use default version: ${VERSION}!"
fi

COREDNS_URL="https://github.com/coredns/coredns/releases/download/v${VERSION}/coredns_${VERSION}_linux_amd64.tgz"
Expand All @@ -15,18 +14,22 @@ SYSUSERS_CONF="https://raw.githubusercontent.com/coredns/deployment/master/syste
TEMPFILES_CONF="https://raw.githubusercontent.com/coredns/deployment/master/systemd/coredns-tmpfiles.conf"
SERVICE_CONF="https://raw.githubusercontent.com/coredns/deployment/master/systemd/coredns.service"

curl -fsSL ${COREDNS_URL} > coredns.tar.gz
curl -fsSL ${SYSUSERS_CONF} > /usr/lib/sysusers.d/coredns-sysusers.conf
curl -fsSL ${TEMPFILES_CONF} > /usr/lib/tmpfiles.d/coredns-tmpfiles.conf
curl -fsSL ${SERVICE_CONF} > /lib/systemd/system/coredns.service
curl -sSL ${COREDNS_URL} > coredns.tar.gz
curl -sSL ${SYSUSERS_CONF} > /usr/lib/sysusers.d/coredns-sysusers.conf
curl -sSL ${TEMPFILES_CONF} > /usr/lib/tmpfiles.d/coredns-tmpfiles.conf
curl -sSL ${SERVICE_CONF} > /lib/systemd/system/coredns.service

tar -zxf coredns.tar.gz --strip-components=1 -C /usr/bin
#tar -zxf coredns.tar.gz --strip-components=1 -C /usr/bin
tar -zxf coredns.tar.gz -C /usr/bin
systemd-sysusers
systemd-tmpfiles --create
systemctl daemon-reload

mkdir -p /etc/coredns
curl -fsSL ${COREDNS_CONF} > /etc/coredns/Corefile
if [ ! -d "/etc/coredns" ]; then
mkdir -p /etc/coredns
fi

curl -sSL ${COREDNS_CONF} > /etc/coredns/Corefile
touch /etc/coredns/hosts

rm -f coredns.tar.gz

0 comments on commit 9a9d39a

Please sign in to comment.