Blame SOURCES/11-dhclient

324fcf
#!/bin/bash
324fcf
# run dhclient.d scripts in an emulated environment
324fcf
324fcf
PATH=/bin:/usr/bin:/sbin
324fcf
ETCDIR=/etc/dhcp
324fcf
SAVEDIR=/var/lib/dhclient
324fcf
interface=$1
324fcf
324fcf
for optname in "${!DHCP4_@}"; do
324fcf
    newoptname=${optname,,};
324fcf
    newoptname=new_${newoptname#dhcp4_};
324fcf
    export "${newoptname}"="${!optname}";
324fcf
done
324fcf
324fcf
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
324fcf
324fcf
[ -f /etc/sysconfig/network-scripts/ifcfg-"${interface}" ] && \
324fcf
    . /etc/sysconfig/network-scripts/ifcfg-"${interface}"
324fcf
324fcf
if [ -d $ETCDIR/dhclient.d ]; then
324fcf
    for f in $ETCDIR/dhclient.d/*.sh; do
324fcf
        if [ -x "${f}" ]; then
324fcf
            subsystem="${f%.sh}"
324fcf
            subsystem="${subsystem##*/}"
324fcf
            . "${f}"
324fcf
            if [ "$2" = "up" ]; then
324fcf
                "${subsystem}_config"
324fcf
            elif [ "$2" = "dhcp4-change" ]; then
324fcf
                if [ "$subsystem" = "chrony" -o "$subsystem" = "ntp" ]; then
324fcf
                    "${subsystem}_config"
324fcf
                fi
324fcf
            elif [ "$2" = "down" ]; then
324fcf
                "${subsystem}_restore"
324fcf
            fi
324fcf
        fi
324fcf
    done
324fcf
fi