#!/bin/sh

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

DoubleLightCamera=`cat $script_path/doubleLight.ini | ./busybox grep "doubleLightCamera:" | ./busybox grep -v grep | sed 's/doubleLightCamera://g' | sed 's/\r//g' | sed 's/\n//g' | sed "s/$(echo -e '\015')//g"`

if [ $? != 0 ]; then
	echo "cann't found doubleLight ini config file"
	exit -1
fi

if [ "$DoubleLightCamera" = "yes" ];then
	mkdir -p /mnt/mtd/Flags/
	touch /mnt/mtd/Flags/initDoubleLightCamera
	./playOrRecord -p 0 audio/doubleLightMode.pcm
fi

if [ "$DoubleLightCamera" = "no" ];then
	rm -rf /mnt/mtd/Flags/DoubleLightCameraFlag
	rm -rf /mnt/mtd/Flags/initDoubleLightCamera
	./playOrRecord -p 0 audio/singleLightMode.pcm
fi
