#!/usr/bin/env bash if [[ "$1" == "start" ]]; then 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 /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