58 lines
1.2 KiB
Bash
58 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
export PATH=$PATH:/bin/vs/cgi-bin:/bin/vs:/komod
|
|
|
|
. /bin/vs/cgi-bin/netenv.conf
|
|
. /bin/vs/cgi-bin/net_func.sh
|
|
. $wifidev_config
|
|
|
|
sd_testpath=/bin/vslocal/sd/VAL_TEST/
|
|
wifitest=${sd_testpath}/wifi_test.conf
|
|
|
|
if [ ! -e /dev/mmcblk0 ];then
|
|
echo -e "\033[45;37m[VAL_TEST]Exit custom test\033[0m"
|
|
exit
|
|
fi
|
|
|
|
|
|
#####挂载SD卡,不存在/dev/mmcblk0p1节点时使用/dev/mmcblk0
|
|
if [ ! -e /dev/mmcblk0p1 ];then
|
|
mount -t vfat /dev/mmcblk0 /bin/vslocal/sd
|
|
else
|
|
mount -t vfat /dev/mmcblk0p1 /bin/vslocal/sd
|
|
fi
|
|
|
|
#####是否挂载成功
|
|
sdInfo=`mount | grep "/bin/vslocal/sd" | awk '{print $1}'`
|
|
if [ $sdInfo"A" == "A" ];then
|
|
echo -e "\033[45;37m[VAL_TEST]Exit custom test\033[0m"
|
|
exit
|
|
fi
|
|
|
|
if [ -d ${sd_testpath} ];then
|
|
|
|
#######把这个目录拷贝到/tmpfs/
|
|
cp ${sd_testpath} /tmpfs/ -raf
|
|
|
|
if [ -x $wifitest ];then
|
|
chmod +x $wifitest
|
|
. $wifitest
|
|
|
|
if [ ! -z $wifissid ];then
|
|
if [ ! -z $wifikey ];then
|
|
########先保存原来的配置
|
|
cp $wifi_config $wifi_config.bak
|
|
/bin/vs/cgi-bin/setwifiattr.cgi "cmd=setwifiattr&-enable=1&-ssid=${wifissid}&-wktype=3&-wepid=0&-key=${wifikey}"
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
|
|
#######卸载SD卡
|
|
umount /bin/vslocal/sd -l
|
|
|
|
if [ -x /bin/vslocal/custom_run.sh ];then
|
|
/bin/vslocal/custom_run.sh &
|
|
fi
|