Blame SOURCES/11-dhclient

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