#!/bin/sh #---------------------------------------------------------------------------- # /etc/rc.d/rc310.dhclient - startup of DHCP client dhclient # was file /etc/rc.d/rc.dhclient # # Creation: 21.10.2001 fm # Last Update: $Id$ #---------------------------------------------------------------------------- delay_max=0 wait_any=no case x$DHCP_CLIENT_TYPE in xdhclient) begin_script DHCP_CLIENT "starting dhcp client dhclient ..." ln -s /etc/dhcpcd.sh /etc/dhclient-exit-hooks mkdir -p /var/db [ "$DHCP_CLIENT_DEBUG" = yes ] && > /var/run/dhcp-debug > /etc/dhclient.conf [ 0$DHCP_CLIENT_N -eq 0 ] || for i in `seq 1 $DHCP_CLIENT_N`; do eval interface=\$DHCP_CLIENT_${i}_IF eval route=\$DHCP_CLIENT_${i}_ROUTE eval usepeerdns=\$DHCP_CLIENT_${i}_USEPEERDNS eval hostname=\$DHCP_CLIENT_${i}_HOSTNAME eval delay=\$DHCP_CLIENT_${i}_STARTDELAY eval wait=\$DHCP_CLIENT_${i}_WAIT if [ 0$delay -gt $delay_max ] then delay_max=$delay fi if [ "$wait" = yes ] then wait_any=yes fi no_def_gw= : ${route:=none} eval interface=\$$interface if [ ! "$interface" ]; then log_error "invalid interface reference $i" continue fi interfaces="$interfaces $interface" [ "$hostname" ] && cat <> /etc/dhclient.conf interface "$interface" { send host-name "$hostname"; } EOF > /var/run/dhcp-client.$interface.$route case $route in imond | default) ip_up_events='yes' > /var/run/dhcp-client.$interface.ip-updown [ "$usepeerdns" = yes ] && echo yes > /var/run/$interface.usepeerdns ;; esac [ "$route" = default ] && > /var/run/$interface.gw done if [ -n "$interfaces" ]; then for i in $interfaces; do ip link set dev $i up done if [ "$delay_max" != "0" ] then log_info "delayed start of dhclient - delay: $delay_max [sec]" sleep $delay_max fi if [ $wait_any = no ] then wait_opt=-nw else wait_opt= fi dhclient -sf /etc/dhclient-script $wait_opt $interfaces fi end_script ;; esac