sample.renew 714 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/sh
  2. # Sample udhcpc bound script
  3. RESOLV_CONF="/etc/udhcpc/resolv.conf"
  4. [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
  5. [ -n "$subnet" ] && NETMASK="netmask $subnet"
  6. /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
  7. if [ -n "$router" ]
  8. then
  9. echo "deleting routers"
  10. while /sbin/route del default gw 0.0.0.0 dev $interface
  11. do :
  12. done
  13. metric=0
  14. for i in $router
  15. do
  16. /sbin/route add default gw $i dev $interface metric $((metric++))
  17. done
  18. fi
  19. # Only replace resolv.conf is we have at least one DNS server
  20. if [ -n "$dns" ]
  21. then
  22. echo -n > $RESOLV_CONF
  23. [ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
  24. for i in $dns
  25. do
  26. echo adding dns $i
  27. echo nameserver $i >> $RESOLV_CONF
  28. done
  29. fi