mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-19 14:14:21 +01:00
Merge pull request #124 from home-assistant/build
Fix dnsmasq for resinos
This commit is contained in:
@@ -1,19 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "Dnsmasq server",
|
"name": "Dnsmasq server",
|
||||||
"version": "0.1",
|
"version": "0.2",
|
||||||
"slug": "dnsmasq",
|
"slug": "dnsmasq",
|
||||||
"description": "A simple dns server with benefits",
|
"description": "A simple dns server with benefits",
|
||||||
"url": "https://home-assistant.io/addons/dnsmasq/",
|
"url": "https://home-assistant.io/addons/dnsmasq/",
|
||||||
"startup": "before",
|
"startup": "before",
|
||||||
"boot": "auto",
|
"boot": "auto",
|
||||||
"ports": {
|
"host_network": true,
|
||||||
"53/udp": 53,
|
|
||||||
"53/tcp": 53
|
|
||||||
},
|
|
||||||
"options": {
|
"options": {
|
||||||
"defaults": ["8.8.8.8", "8.8.4.4"],
|
"defaults": ["8.8.8.8", "8.8.4.4"],
|
||||||
"forwards": [],
|
"forwards": [],
|
||||||
"hosts": []
|
"hosts": [],
|
||||||
|
"interface": "eth0"
|
||||||
},
|
},
|
||||||
"schema": {
|
"schema": {
|
||||||
"defaults": ["str"],
|
"defaults": ["str"],
|
||||||
@@ -28,7 +26,8 @@
|
|||||||
"host": "str",
|
"host": "str",
|
||||||
"ip": "str"
|
"ip": "str"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"interface": "str"
|
||||||
},
|
},
|
||||||
"image": "homeassistant/{arch}-addon-dnsmasq"
|
"image": "homeassistant/{arch}-addon-dnsmasq"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ CONFIG_PATH=/data/options.json
|
|||||||
DEFAULTS=$(jq --raw-output '.defaults[]' $CONFIG_PATH)
|
DEFAULTS=$(jq --raw-output '.defaults[]' $CONFIG_PATH)
|
||||||
FORWARDS=$(jq --raw-output '.forwards | length' $CONFIG_PATH)
|
FORWARDS=$(jq --raw-output '.forwards | length' $CONFIG_PATH)
|
||||||
HOSTS=$(jq --raw-output '.hosts | length' $CONFIG_PATH)
|
HOSTS=$(jq --raw-output '.hosts | length' $CONFIG_PATH)
|
||||||
|
INTERFACE=$(jq --raw-output '.interface' $CONFIG_PATH)
|
||||||
|
|
||||||
|
# Bind to interface
|
||||||
|
if [ -z "$INTERFACE" ]; then
|
||||||
|
echo "interface=$INTERFACE" >> /etc/dnsmasq.conf
|
||||||
|
fi
|
||||||
|
|
||||||
# Add default forward servers
|
# Add default forward servers
|
||||||
for line in $DEFAULTS; do
|
for line in $DEFAULTS; do
|
||||||
@@ -29,4 +35,4 @@ for (( i=0; i < "$HOSTS"; i++ )); do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# run dnsmasq
|
# run dnsmasq
|
||||||
exec dnsmasq -C /etc/dnsmasq.conf < /dev/null
|
exec dnsmasq -C /etc/dnsmasq.conf -z < /dev/null
|
||||||
|
|||||||
Reference in New Issue
Block a user