#!/bin/sh
#
# dhclient-script for BeOS
#
#
if [ x$reason = xPREINIT ]; then
  ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 up >/dev/null 2>&1
  route add 255.255.255.255 dev $interface 2>&1
  exit 0
fi
if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
   [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
	
	echo New ip $new_ip_address New subnet $new_subnet_mask
    ifconfig $interface $new_ip_address $new_subnet_mask >/dev/null 2>&1
    for router in $new_routers ; do
      route add default gw $router dev $interface >/dev/null 2>&1
    done

  echo search $new_domain_name >/etc/resolv.conf
  for nameserver in $new_domain_name_servers; do
    echo nameserver $nameserver >>/etc/resolv.conf
  done
  exit 0
fi
if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then
  if [ x$old_ip_address != x ]; then
    route delete $old_ip_address 127.1 >/dev/null 2>&1
    for $router in $old_routers ; do
      route delete default $router >/dev/null 2>&1
    done
  fi
  exit 0
fi
