-
Notifications
You must be signed in to change notification settings - Fork 9
/
snx_autorun.sh
58 lines (41 loc) · 1.52 KB
/
snx_autorun.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
[ -z "${MDEV}" ] && return
gpio_aud write 1 4 1
CFILE="/media/${MDEV}/config.txt"
TFILE="/media/${MDEV}/files.tar"
if [ -e ${CFILE} ] ; then
cp ${CFILE} /etc/rtsp/.
source ${CFILE}
hostname ${HOSTNAME}
echo ${HOSTNAME} > /etc/hostname
sed -i -e 's/ssid=".*"$/ssid="'${SSID}'"/g' /etc/wpa_supplicant.conf
sed -i -e 's/psk=".*"$/psk="'${PSK}'"/g' /etc/wpa_supplicant.conf
echo ${TZ} > /etc/TZ
ps | grep -E "(udhcpc|wpa_supplicant)" | grep -v grep | sed 's/^\s*//' | cut -d " " -f 1 | xargs kill -9
wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf &
udhcpc -i wlan0 -p /var/run/udhcpc.pid -b &
/etc/rtsp/pcm_play /usr/share/notify/binbin.wav
fi
if [ ! -e /etc/rtsp/OK -o "${CHUCKNORRIS}" == "true" ] ; then
MYSUM=`md5sum ${TFILE}|cut -d " " -f1`
if [ "${MYSUM}" != "${MD5SUM}" ] ; then
return
fi
ps | grep -E "(etc|ntp|udhcpc|iCamera|test_UP|iSC3S|wpa_supplicant)" | grep -v grep | sed 's/^\s*//' | cut -d " " -f 1 | xargs kill -9
tar xf /media/mmcblk0p1/files.tar -C /tmp/ pcm_play
/tmp/pcm_play /usr/share/notify/CN/speaker.wav
rm -rf /etc/app /etc/miio* /etc/rtsp
mkdir -p /etc/rtsp/
cd /etc/rtsp/
tar xf ${TFILE}
cp ${CFILE} .
chown root:root /etc/rtsp/ -R
sed -i '/iSC3S/d' /etc/init.d/rcS
sed -i '/singleBoadTest/d' /etc/init.d/rcS
sed -i 's/^modprobe snx_wdt/\#modprobe snx_wdt/' /etc/init.d/rcS
sed -i '/rtsp/d' /etc/init.d/rc.local
echo "/etc/rtsp/my.rc.local & " >> /etc/init.d/rc.local
touch /etc/rtsp/OK
/etc/rtsp/pcm_play /usr/share/notify/CN/speaker.wav
/etc/rtsp/my.rc.local &
fi