#!/bin/bash

#Don't modify these lines of code
#if [ -f "/root/restart_count.log" ];then
#	/bin/bash /usr/local/bin/test_reboot.sh
#fi
#check factory reset
etc/scripts/S99input-event-daemon start

/etc/scripts/gpio_init.sh

/etc/scripts/audio_init.sh

/etc/scripts/product_model.sh
chmod 777 /dev/ttyS*
# Create dummy video node for chromium V4L2 VDA/VEA with rkmpp plugin
#echo dec > /dev/video-dec0
#echo enc > /dev/video-enc0
chmod 660 /dev/video-*
#chown root:video /dev/video-*
# The chromium using fixed pathes for libv4l2.so
#ln -rsf /usr/lib/*/libv4l2.so /usr/lib/
#if [ -e /usr/lib/aarch64-linux-gnu/ ]; then
#    ln -Tsf lib /usr/lib64
#fi
# bash /etc/init.d/rkwifibt.sh &

#audio dir
if [ ! -d /oem/audio ];then
    mkdir -p /oem/audio
    ln -snf /usr/share/baresip/bells_music_tone.wav /oem/audio/1.wav
    ln -snf /usr/share/baresip/bells_music_tone.wav /oem/audio/2.wav
    ln -snf /usr/share/baresip/bells_music_tone.wav /oem/audio/3.wav
    ln -snf /usr/share/baresip/bells_music_tone.wav /oem/audio/4.wav
    ln -snf /usr/share/baresip/bells_music_tone.wav /oem/audio/5.wav
fi

sleep 5

/etc/scripts/play_ip &

/etc/scripts/watch.sh start > /dev/null 2>&1 &

bash /usr/bin/init.sh

#cron reboot
/etc/scripts/shell_action.sh set_cronreboot

# udhcpc -i usb0 -n
/etc/scripts/system_led.sh &

# write start log
redis-cli LPUSH writelog-channel "INIT,System Started,"

exit 0
