#!/bin/sh

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

DayNightMode=`cat $script_path/dayNight.ini | ./busybox grep "dayNightMode:" | ./busybox grep -v grep | sed 's/dayNightMode://g' | sed 's/\r//g' | sed 's/\n//g' | sed "s/$(echo -e '\015')//g"`
if [ $? != 0 ]; then
	echo "cann't found DayNightMode ini config file"
	exit -1
fi

if [ "$DayNightMode" -le "10" ];then
	mkdir -p /mnt/mtd/Flags/
	echo -n "0x0000000" > /mnt/mtd/Flags/KeepDayNightModeFlag
	echo -n "$DayNightMode" >> /mnt/mtd/Flags/KeepDayNightModeFlag
	./simple_adec_bind_ao -r 8000 -t g711a -i audio/dayLightSetSuccess.pcm
fi
