All pastes #525313 Raw Edit

default-S60dnsmasq

public shellscript v1 · immutable
#525313 ·published 2007-05-31 09:52 UTC
rendered paste body
root@Normans_Desktop:/# cat /etc/init.d/S60dnsmasq#!/bin/sh# The following is to automatically configure the DHCP settings# based on nvram settings. Feel free to replace all this crap# with a simple "dnsmasq" and manage everything via the# /etc/dnsmasq.conf config file# DHCP interface (lan, wan, wifi -- any ifup *)iface=lanifname=$(nvram get ${iface}_ifname)udhcpc -n -q -R -s /bin/true -i $ifname >&- || {  # no existing DHCP server?  # calculate settings   ipaddr=$(nvram get ${iface}_ipaddr)  netmask=$(nvram get ${iface}_netmask)    start=$(nvram get dhcp_start)      num=$(nvram get dhcp_num)  eval $(ipcalc.sh $ipaddr $netmask ${start:-100} ${num:-150})  lease=$(nvram get dhcp_lease)  # and pass the args via the commandline  # (because trying to edit the config from here is crazy)  args="-K -F $START,$END,$NETMASK,${lease:-12h}"}# ignore requests from wan interfacewanproto=$(nvram get wan_proto)[ -z "$wanproto" -o "$wanproto" = "none" ] || args="${args} -I $(nvram get wan_ifname)"dnsmasq ${args} && {        # use dnsmasq for local dns requests        rm -f /tmp/resolv.conf        cat > /tmp/resolv.conf <<EOFnameserver 127.0.0.1search lanEOF}