Blame SOURCES/11-dhclient

c8bb8f
#!/bin/bash
c8bb8f
# run dhclient.d scripts in an emulated environment
c8bb8f
c8bb8f
PATH=/bin:/usr/bin:/sbin
c8bb8f
SAVEDIR=/var/lib/dhclient
c8bb8f
ETCDIR=/etc/dhcp
c8bb8f
interface=$1
c8bb8f
c8bb8f
eval "$(
c8bb8f
declare | LC_ALL=C grep '^DHCP4_[A-Z_]*=' | while read opt; do
c8bb8f
    optname=${opt%%=*}
c8bb8f
    optname=${optname,,}
c8bb8f
    optname=new_${optname#dhcp4_}
c8bb8f
    optvalue=${opt#*=}
c8bb8f
    echo "export $optname=$optvalue"
c8bb8f
done
c8bb8f
)"
c8bb8f
c8bb8f
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
c8bb8f
c8bb8f
[ -f /etc/sysconfig/network-scripts/ifcfg-$interface ] && \
c8bb8f
    . /etc/sysconfig/network-scripts/ifcfg-$interface
c8bb8f
c8bb8f
if [ -d $ETCDIR/dhclient.d ]; then
c8bb8f
    for f in $ETCDIR/dhclient.d/*.sh; do
c8bb8f
        if [ -x $f ]; then
c8bb8f
            subsystem="${f%.sh}"
c8bb8f
            subsystem="${subsystem##*/}"
c8bb8f
            . ${f}
c8bb8f
            if [ "$2" = "up" ]; then
c8bb8f
                "${subsystem}_config"
c8bb8f
            elif [ "$2" = "down" ]; then
c8bb8f
                "${subsystem}_restore"
c8bb8f
            fi
c8bb8f
        fi
c8bb8f
    done
c8bb8f
fi