Annotation of embedaddon/dhcp/client/scripts/nextstep, revision 1.1.1.1

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>