ub-dhcp/11-ub-dhclient
Jeiwei Li 4cd6768970 Release based on dhcp 4.4.3
driver inclusion
category: feature
bugzilla: https://gitee.com/src-openeuler/ub-dhcp/issues/I86CZH
CVE: NA

----------------------------------------------------------------------

Release based on dhcp 4.4.3

Signed-off-by: Jeiwei Li <lijiewei5@huawei.com>
2023-10-25 15:57:43 +08:00

38 lines
1.0 KiB
Bash

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