workflow-test/entrypoint.sh
Jonas Forsberg 7a40fda341
All checks were successful
Lint and Test Charts / lint-test (push) Successful in 18s
Testing pipes / Explore-Gitea-Actions (push) Successful in 32s
.
2024-10-15 11:07:22 +02:00

31 lines
916 B
Bash

#!/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