1 1.1 christos #!/bin/sh 2 1.1 christos # 3 1.1 christos # simplified dhclient-script for NeXTSTEP/OPENSTEP 4 1.1 christos # 5 1.1 christos # removed a lot of the cruft from the netbsd version since NeXTSTEP doesn't 6 1.1 christos # support aliases and lots of things were breaking for no good reason 7 1.1 christos # 8 1.1 christos # 14 Sep 1997, David W. Young 9 1.1 christos # 10 1.1 christos if [ x$reason = xPREINIT ]; then 11 1.1 christos ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 up >/dev/null 2>&1 12 1.1 christos exit 0 13 1.1 christos fi 14 1.1 christos if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \ 15 1.1 christos [ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then 16 1.1 christos current_hostname=`hostname` 17 1.1 christos if [ x$current_hostname = x ] || \ 18 1.1 christos [ x$current_hostname = x$old_host_name ]; then 19 1.1 christos if [ x$current_hostname = x ] || \ 20 1.1 christos [ x$new_host_name != x$old_host_name ]; then 21 1.1 christos hostname $new_host_name 22 1.1 christos fi 23 1.1 christos fi 24 1.1 christos 25 1.1 christos if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ] 26 1.1 christos then 27 1.1 christos ifconfig $interface $new_ip_address netmask $new_subnet_mask \ 28 1.1 christos >/dev/null 2>&1 29 1.1 christos route add $new_ip_address 127.1 0 >/dev/null 2>&1 30 1.1 christos for router in $new_routers ; do 31 1.1 christos route add default $router 1 >/dev/null 2>&1 32 1.1 christos done 33 1.1 christos fi 34 1.1 christos if [ x"$new_domain_name_servers" != x ]; then 35 1.1 christos cat /dev/null > /etc/resolv.conf.dhclient 36 1.1 christos if [ "x$new_domain_search" != x ]; then 37 1.1 christos echo search $new_domain_search >> /etc/resolv.conf.dhclient 38 1.1 christos elif [ "x$new_domain_name" != x ]; then 39 1.1 christos # Note that the DHCP 'Domain Name Option' is really just a domain 40 1.1 christos # name, and that this practice of using the domain name option as 41 1.1 christos # a search path is both nonstandard and deprecated. 42 1.1 christos echo search $new_domain_name >> /etc/resolv.conf.dhclient 43 1.1 christos fi 44 1.1 christos for nameserver in $new_domain_name_servers; do 45 1.1 christos echo nameserver $nameserver >>/etc/resolv.conf.dhclient 46 1.1 christos done 47 1.1 christos 48 1.1 christos mv /etc/resolv.conf.dhclient /etc/resolv.conf 49 1.1 christos fi 50 1.1 christos exit 0 51 1.1 christos fi 52 1.1 christos if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ] || [ x$reason = xRELEASE ] \ 53 1.1 christos || [ x$reason = xSTOP ]; then 54 1.1 christos if [ x$old_ip_address != x ]; then 55 1.1 christos route delete $old_ip_address 127.1 >/dev/null 2>&1 56 1.1 christos for $router in $old_routers ; do 57 1.1 christos route delete default $router >/dev/null 2>&1 58 1.1 christos done 59 1.1 christos fi 60 1.1 christos exit 0 61 1.1 christos fi 62