#!/bin/sh
# Copyright (C) 2006 OpenWrt.org
# Copyright (C) 2010 Vertical Communications

pi_disable_DFS_if_factory() {
	CARD_PROFILE_PATH=`cat /etc/wireless/l1profile.dat | grep INDEX0_profile_path |awk -F "[=;]" '{ print $2 }'`
	DAT_FILE_PATH=`cat ${CARD_PROFILE_PATH} | grep BN1_profile_path |awk -F "[=;]" '{ print $2 }'`

	if [ x"$(bdinfo factory)" = x"1" ]; then
		if [ -f "${DAT_FILE_PATH}" ]; then
			if grep -q "DfsEnable=1" "${DAT_FILE_PATH}"; then
				sed -i "s/DfsEnable=1/DfsEnable=0/g" ${DAT_FILE_PATH}
			fi
		fi
	fi
}

boot_hook_add preinit_main pi_disable_DFS_if_factory

