mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-17 05:04:21 +01:00
@@ -1,19 +1,17 @@
|
||||
{
|
||||
"name": "Dnsmasq server",
|
||||
"version": "0.1",
|
||||
"version": "0.2",
|
||||
"slug": "dnsmasq",
|
||||
"description": "A simple dns server with benefits",
|
||||
"url": "https://home-assistant.io/addons/dnsmasq/",
|
||||
"startup": "before",
|
||||
"boot": "auto",
|
||||
"ports": {
|
||||
"53/udp": 53,
|
||||
"53/tcp": 53
|
||||
},
|
||||
"host_network": true,
|
||||
"options": {
|
||||
"defaults": ["8.8.8.8", "8.8.4.4"],
|
||||
"forwards": [],
|
||||
"hosts": []
|
||||
"hosts": [],
|
||||
"interface": "eth0"
|
||||
},
|
||||
"schema": {
|
||||
"defaults": ["str"],
|
||||
@@ -28,7 +26,8 @@
|
||||
"host": "str",
|
||||
"ip": "str"
|
||||
}
|
||||
]
|
||||
],
|
||||
"interface": "str"
|
||||
},
|
||||
"image": "homeassistant/{arch}-addon-dnsmasq"
|
||||
}
|
||||
|
||||
@@ -6,6 +6,12 @@ CONFIG_PATH=/data/options.json
|
||||
DEFAULTS=$(jq --raw-output '.defaults[]' $CONFIG_PATH)
|
||||
FORWARDS=$(jq --raw-output '.forwards | 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
|
||||
for line in $DEFAULTS; do
|
||||
@@ -29,4 +35,4 @@ for (( i=0; i < "$HOSTS"; i++ )); do
|
||||
done
|
||||
|
||||
# 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