Update S09dnsmasq

Smarter way to detect resolv.conf rather than waiting on a sleep function and HOPING its there...
This commit is contained in:
sideup66 2024-10-24 02:24:31 -04:00 committed by GitHub
parent 32dcd217b9
commit c396f7b4c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -16,7 +16,10 @@ dnsmasq_launch() {
if [[ "$ENABLE_LOCAL_DNS" == "true" ]]; then if [[ "$ENABLE_LOCAL_DNS" == "true" ]]; then
echo "wait for resolv.conf creation from iCamera" echo "wait for resolv.conf creation from iCamera"
sleep 5 while [ ! -f /tmp/resolv.conf ]
do
sleep .2
done
#kill the system dnsmasq if present #kill the system dnsmasq if present
dmon_pid=$(pgrep -f "dmon.*dnsmasq") dmon_pid=$(pgrep -f "dmon.*dnsmasq")
if [ -n "$dmon_pid" ]; then if [ -n "$dmon_pid" ]; then
@ -28,7 +31,6 @@ dnsmasq_launch() {
else else
/opt/wz_mini/bin/dnsmasq -C /opt/wz_mini/etc/dnsmasq.conf /opt/wz_mini/bin/dnsmasq -C /opt/wz_mini/etc/dnsmasq.conf
fi fi
sleep 5
#mount the resolv.conf file as read only. Something (ICamera?) randomly seems to change it. #mount the resolv.conf file as read only. Something (ICamera?) randomly seems to change it.
mount --bind /opt/wz_mini/etc/resolv.conf /tmp/resolv.conf mount --bind /opt/wz_mini/etc/resolv.conf /tmp/resolv.conf
mount -o bind,remount,ro /tmp/resolv.conf mount -o bind,remount,ro /tmp/resolv.conf