From 4fd5cf5da86eb68cfa3d707cb433317ff2a06901 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Wed, 18 Dec 2019 13:55:30 +0100 Subject: [PATCH] dnsmasq: Collection of small improvements (#899) * dnsmasq: Prettier YAML & JSON files * dnsmasq: Update add-on URL * dnsmasq: Pin add-on base images * dnsmasq: Move data files into data folder * dnsmasq: Tweaks documentation --- dnsmasq/Dockerfile | 4 ++-- dnsmasq/README.md | 10 +++++----- dnsmasq/azure-pipelines.yml | 15 +++++++-------- dnsmasq/build.json | 9 +++++++++ dnsmasq/config.json | 19 ++++--------------- dnsmasq/{ => data}/dnsmasq.conf | 0 dnsmasq/{ => data}/run.sh | 3 ++- 7 files changed, 29 insertions(+), 31 deletions(-) create mode 100644 dnsmasq/build.json rename dnsmasq/{ => data}/dnsmasq.conf (100%) rename dnsmasq/{ => data}/run.sh (98%) diff --git a/dnsmasq/Dockerfile b/dnsmasq/Dockerfile index ed4c9305fa8..2eb264b8a9f 100644 --- a/dnsmasq/Dockerfile +++ b/dnsmasq/Dockerfile @@ -8,7 +8,7 @@ ENV LANG C.UTF-8 RUN apk add --no-cache dnsmasq # Copy data -COPY run.sh / -COPY dnsmasq.conf /etc/ +COPY data/run.sh / +COPY data/dnsmasq.conf /etc/ CMD [ "/run.sh" ] diff --git a/dnsmasq/README.md b/dnsmasq/README.md index e89ac7b73d5..d12f6f68b69 100644 --- a/dnsmasq/README.md +++ b/dnsmasq/README.md @@ -12,7 +12,7 @@ an internal address inside your network. ## Installation -The installation of this add-on is straightforward and easy to do. +Follow these steps to get the add-on installed on your system: 1. Navigate in your Home Assistant frontend to **Hass.io** -> **Add-on Store**. 2. Find the "Dnsmasq" add-on and click it. @@ -55,11 +55,11 @@ Google's public DNS servers: `"8.8.8.8", "8.8.4.4". This option allows you to list domain that are forwarded to a different (not the default) upstream DNS server. -#### Option: `forwards` -> `domain` +#### Option: `forwards.domain` The domain to forward to a different upstream DNS server. -#### Option: `forwards` -> `server` +#### Option: `forwards.server` The DNS server to forward the request for this domain to. @@ -76,11 +76,11 @@ it would resolve normally. This options allows you to create a so called: Split DNS. -#### Option: `hosts` -> `host` +#### Option: `hosts.host` The hostname or domainname to resolve locally. -#### Option: `hosts` -> `ip` +#### Option: `hosts.ip` The IP address Dnsmasq should respond with in its DNS answer. diff --git a/dnsmasq/azure-pipelines.yml b/dnsmasq/azure-pipelines.yml index e36843f8159..2ab6a993b90 100644 --- a/dnsmasq/azure-pipelines.yml +++ b/dnsmasq/azure-pipelines.yml @@ -3,20 +3,19 @@ trigger: branches: include: - - master + - master paths: include: - - dnsmasq/* + - dnsmasq/* pr: none variables: - name: versionBuilder - value: '2.0' + value: "2.0" - group: docker - jobs: -- template: /.azure/azp-template-addon.yml - parameters: - addon: 'dnsmasq' - arch: '--all' + - template: /.azure/azp-template-addon.yml + parameters: + addon: "dnsmasq" + arch: "--all" diff --git a/dnsmasq/build.json b/dnsmasq/build.json new file mode 100644 index 00000000000..bbf7adee049 --- /dev/null +++ b/dnsmasq/build.json @@ -0,0 +1,9 @@ +{ + "build_from": { + "aarch64": "homeassistant/aarch64-base:3.10", + "amd64": "homeassistant/amd64-base:3.10", + "armhf": "homeassistant/armhf-base:3.10", + "armv7": "homeassistant/armv7-base:3.10", + "i386": "homeassistant/i386-base:3.10" + } +} diff --git a/dnsmasq/config.json b/dnsmasq/config.json index 63397f4d09f..7948d88b19f 100644 --- a/dnsmasq/config.json +++ b/dnsmasq/config.json @@ -3,14 +3,8 @@ "version": "1.3", "slug": "dnsmasq", "description": "A simple DNS server", - "url": "https://home-assistant.io/addons/dnsmasq/", - "arch": [ - "armhf", - "armv7", - "aarch64", - "amd64", - "i386" - ], + "url": "https://github.com/home-assistant/hassio-addons/tree/master/dnsmasq", + "arch": ["armhf", "armv7", "aarch64", "amd64", "i386"], "startup": "system", "boot": "auto", "ports": { @@ -18,17 +12,12 @@ "53/udp": 53 }, "options": { - "defaults": [ - "8.8.8.8", - "8.8.4.4" - ], + "defaults": ["8.8.8.8", "8.8.4.4"], "forwards": [], "hosts": [] }, "schema": { - "defaults": [ - "str" - ], + "defaults": ["str"], "forwards": [ { "domain": "str", diff --git a/dnsmasq/dnsmasq.conf b/dnsmasq/data/dnsmasq.conf similarity index 100% rename from dnsmasq/dnsmasq.conf rename to dnsmasq/data/dnsmasq.conf diff --git a/dnsmasq/run.sh b/dnsmasq/data/run.sh similarity index 98% rename from dnsmasq/run.sh rename to dnsmasq/data/run.sh index 046ca5c40ba..1f5f9e2a38a 100755 --- a/dnsmasq/run.sh +++ b/dnsmasq/data/run.sh @@ -4,6 +4,7 @@ set -e CONFIG="/etc/dnsmasq.conf" bashio::log.info "Configuring dnsmasq..." + # Add default forward servers for server in $(bashio::config 'defaults'); do echo "server=${server}" >> "${CONFIG}" @@ -25,6 +26,6 @@ for host in $(bashio::config 'hosts|keys'); do echo "address=/${HOST}/${IP}" >> "${CONFIG}" done -# run dnsmasq +# Run dnsmasq bashio::log.info "Starting dnsmasq..." exec dnsmasq -C "${CONFIG}" -z < /dev/null