#!/bin/sh # $Id$ # # Grabbing the config. # . /etc/config # # Grabbing the function library. # . /etc/functions.inc HARGS= [ "$USER_IDENT" != "" ] && HARGS="-H $USER_IDENT" if $(bool_value "$DHCP_USE_LAST_ADDR" && [ -f /mnt/tmp/dhcp.add ]) then # We're going to need an address # mount -t $SOURCE_FS $SOURCE_DEV /mnt/tmp LAST_DHCP_ADDR=$(cat /mnt/tmp/dhcp.add | tr -d '\n' | tr -d '\r') # if [ -n "$LAST_DHCP_ADDR" ] if [ "$LAST_DHCP_ADDR" != "" ] then echo "Gonna ask for $LAST_DHCP_ADDR" if /sbin/udhcpc -t 3 -r $LAST_DHCP_ADDR -n -s /etc/udhcpcrenew.sh $HARGS -i $OUTSIDE_DEV then . /etc/outside.info echo $OUTSIDE_IP > /mnt/tmp/dhcp.add 2> /dev/null exit 0 fi fi fi # # OK, either we did not have an existing address or we did not get it. # if /sbin/udhcpc -n -s /etc/udhcpcrenew.sh $HARGS -i $OUTSIDE_DEV then if $(bool_value "$DHCP_USE_LAST_ADDR" && touch /mnt/tmp/dhcp.add 2> /dev/null) then . /etc/outside.info echo $OUTSIDE_IP > /mnt/tmp/dhcp.add 2> /dev/null fi exit 0 else exit 1 fi