sample.renew 619 B

12345678910111213141516171819202122232425262728293031
  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. echo -n > $RESOLV_CONF
  20. [ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
  21. for i in $dns
  22. do
  23. echo adding dns $i
  24. echo nameserver $i >> $RESOLV_CONF
  25. done