9ba8b65
#!/bin/bash
9ba8b65
export LC_ALL=C
9ba8b65
9ba8b65
[ -f /etc/sysconfig/dhcpd ] && . /etc/sysconfig/dhcpd
9ba8b65
9ba8b65
# restart dhcpd whenever $1 interface is brought up by NM (rhbz #565921)
9ba8b65
if [ "$2" = "up" ]; then
9ba8b65
	# exit if the service is not configured to be started in the current runlevel
77e77ea
	/bin/systemctl is-enabled dhcpd.service || exit 0
9ba8b65
9ba8b65
	# exit if dhcpd is not defined to listen on $1
9ba8b65
	# i.e. if there are interfaces defined in DHCPDARGS and $1 is not among them
9ba8b65
	if [ -n "${DHCPDARGS}" ] &&
9ba8b65
	   [[ "${DHCPDARGS}" == *eth* ]] &&
9ba8b65
	   [[ "${DHCPDARGS}" != *$1* ]]; then
9ba8b65
		exit 0
9ba8b65
	fi
9ba8b65
9ba8b65
	# restart service
77e77ea
	/bin/systemctl restart dhcpd.service || :
9ba8b65
fi