#!/bin/sh

script_path=`echo $0 | awk -F '/' '{for(i=2;i<NF;i++) printf"/"$i}'`

echo  $script_path >> test
CUSTOM_APN_LIST=`cat $script_path/CustomApnList.ini | ./busybox grep "CustomApnList:" | ./busybox grep -v grep | sed 's/CustomApnList://g' | sed 's/\r//g' | sed 's/\n//g' | sed "s/$(echo -e '\015')//g"`
if [ $? != 0 ]; then
	echo "cann't found ProductionTestMode in config file"
	exit -1
fi
echo "CUSTOM_APN_LIST:$CUSTOM_APN_LIST"  
srcApnFile=$script_path/customApnList.json
dstApnFile=/mnt/mtd/Flags/customApnList.json
if [ "$CUSTOM_APN_LIST" = "yes" ]; then
	[ -e "$dstApnFile" ] && rm $dstApnFile
	cp $srcApnFile $dstApnFile
	./simple_adec_bind_ao -r 8000 -t g711a -i audio/addCustomApn.pcm
	echo "cat $srcApnFile" >> test
elif [ "$CUSTOM_APN_LIST" = "no" ];then
	[ -e "$dstApnFile" ] && rm $dstApnFile
	./simple_adec_bind_ao -r 8000 -t g711a -i audio/deleteCustomApn.pcm
fi





