2023-04-13 12:45:03 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
|
|
if [[ "$1" == "start" ]]; then
|
2023-04-13 14:19:02 +00:00
|
|
|
if [[ ! -f /config/dnsmasq.conf ]]; then
|
|
|
|
echo "* Creating /config/dnsmasq.conf"
|
|
|
|
sed 's/^conf-dir=\/etc\//conf-dir=\/config\//g' /etc/dnsmasq.conf > /config/dnsmasq.conf
|
|
|
|
fi
|
|
|
|
if [[ ! -f /config/hosts/hosts ]]; then
|
|
|
|
echo "* Creating /config/hosts/hosts"
|
|
|
|
mkdir /config/hosts
|
|
|
|
cp /etc/hosts /config/hosts/hosts
|
|
|
|
fi
|
|
|
|
if [[ ! -f /config/resolv.conf ]]; then
|
|
|
|
echo "* Creating /config/resolv.conf"
|
|
|
|
cp /etc/resolv.conf /config/resolv.conf
|
|
|
|
fi
|
|
|
|
if [[ ! -d /config/dnsmasq.d ]]; then
|
|
|
|
echo "* Creating /config/dnsmasq.d"
|
|
|
|
mkdir /config/dnsmasq.d
|
|
|
|
fi
|
2023-04-13 12:45:03 +00:00
|
|
|
/usr/sbin/dnsmasq \
|
|
|
|
--conf-fil=/config/dnsmasq.conf \
|
|
|
|
--no-daemon --no-hosts \
|
|
|
|
--keep-in-foreground \
|
|
|
|
--resolv-file=/config/resolv.conf \
|
|
|
|
--hostsdir=/config/hosts
|
|
|
|
else
|
|
|
|
exec "$@"
|
|
|
|
fi
|