3
0

simple.script 834 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. # udhcpc script edited by Tim Riker <Tim@Rikers.org>
  3. [ -z "$1" ] && echo "Error: should be called from udhcpc" && exit 1
  4. RESOLV_CONF="/etc/resolv.conf"
  5. [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
  6. [ -n "$subnet" ] && NETMASK="netmask $subnet"
  7. case "$1" in
  8. deconfig)
  9. /sbin/ifconfig $interface 0.0.0.0
  10. ;;
  11. renew|bound)
  12. /sbin/ifconfig $interface $ip $BROADCAST $NETMASK
  13. if [ -n "$router" ] ; then
  14. echo "deleting routers"
  15. while route del default gw 0.0.0.0 dev $interface ; do
  16. :
  17. done
  18. metric=0
  19. for i in $router ; do
  20. route add default gw $i dev $interface metric $((metric++))
  21. done
  22. fi
  23. echo -n > $RESOLV_CONF
  24. [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF
  25. for i in $dns ; do
  26. echo adding dns $i
  27. echo nameserver $i >> $RESOLV_CONF
  28. done
  29. ;;
  30. esac
  31. exit 0