#!/bin/sh # $Id: dhcp.script,v 1.4 2003/11/10 03:36:56 diego Exp $ # # udhcpc script edited by Tim Riker # Modifyed for PXES by Anders Damm # Modifyed for PXES by Diego Torres Milano RESOLV_CONF="/etc/resolv.conf" INFO="/etc/udhcpc-$interface.info" [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" [ -n "$subnet" ] && NETMASK="netmask $subnet" case "$1" in deconfig) /sbin/ifconfig $interface 0.0.0.0 ;; renew|bound) /sbin/ifconfig $interface $ip $BROADCAST $NETMASK if [ -n "$router" ] ; then while ip route del default scope global nexthop dev $interface ; do : done 2>/dev/null for i in $router ; do ip route add default via $i dev $interface done fi [ -n "$hostname" ] && hostname "$hostname" echo -n > $RESOLV_CONF [ -n "$domain" ] && echo search $domain >> $RESOLV_CONF # Save information ( echo "INTERFACE=$interface" echo "IPADDR=$ip" echo "NEXTSERVER=$siaddr" echo "DHCPNAME=$sname" echo "BOOTFILE=$boot_file" echo "NETMASK=$subnet" echo "TIMEZONE=$timezone" echo "GATEWAY=$router" echo "TIMESERVER=$timesvr" echo "NAMESERVER=$namesvr" echo "DNS=$dns" echo "LOGSERVER=$logsvr" echo "COOKISERVER=$cookiesvr" echo "LPRSERVER=$lprsvr" echo "HOSTNAME=$hostname" echo "BOOTSIZE=$bootsize" echo "DOMAIN=$domain" echo "SWAPSERVER=$swapsvr" echo "ROOTPATH=$rootpath" echo "TTL=$ipttl" echo "MTU=$mtu" echo "BROADCAST=$broadcast" echo "NTPSERVER=$ntpsrv" echo "WINS=$wins" echo "LEASETIME=$lease" echo "DHCPTYPE=$dhcptype" echo "DHCPSIADDR=$serverid" echo "MESSAGE=$message" echo "TFTP=$tftp" ) > $INFO for i in $dns ; do echo nameserver $i >> $RESOLV_CONF done ;; esac exit 0