#!/bin/sh

TMP_INFO="/tmp/dhcpd-info"

DHCP_ETC="/etc/dhcpd"

PXE_VENDOR_OPT="dhcp-vendorclass=set:pxe,PXEClient"

for info_file in `ls ${TMP_INFO}/dhcpd*.info`; do
	mv ${info_file} /etc/dhcpd/
done
rm -r ${TMP_INFO} > /dev/null 2>&1

for pxe_conf_file in `ls ${DHCP_ETC}/dhcpd-*-pxe.conf`; do
	result_vendor=`grep "dhcp-vendorclass" -c ${pxe_conf_file}`
	if [ "${result_vendor}" == "0" ]; then
		echo "${PXE_VENDOR_OPT}" >> "${pxe_conf_file}"
	fi

        result=`grep ",,,," -c ${pxe_conf_file}`
        if [ "${result}" != "0" ]; then
                rm "${pxe_conf_file}"
		pxe_info_file=`echo "${pxe_conf_file}" | sed 's/conf/info/g'`
		rm "${pxe_info_file}"
        fi
done

exit 0
