57 lines
965 B
Bash
57 lines
965 B
Bash
#!/bin/sh
|
|
|
|
dev_node="/dev/mmcblk0p1"
|
|
sd_mount_dir=/bin/vslocal/sd
|
|
upg_file="rt-upgrade-gk7205v200.ov"
|
|
|
|
###SD设备节点都不在
|
|
if [ -e /dev/mmcblk0p1 ];then
|
|
dev_node="/dev/mmcblk0p1"
|
|
elif [ -e /dev/mmcblk0 ];then
|
|
dev_node="/dev/mmcblk0"
|
|
else
|
|
exit
|
|
fi
|
|
|
|
insmod /komod/extdrv/exfat.ko
|
|
|
|
mount -t exfat ${dev_node} ${sd_mount_dir}
|
|
|
|
ls ${sd_mount_dir}
|
|
|
|
if [ ! -e ${sd_mount_dir}/${upg_file} ];then
|
|
umount -l ${sd_mount_dir}
|
|
rmmod exfat;
|
|
exit;
|
|
fi
|
|
|
|
###检验升级包是否已经升级过,升级包的前4个字节是CRC
|
|
file_crc=`packet_crc ${sd_mount_dir}/${upg_file}`
|
|
save_crc=`paraconf r 2 upg_crc`
|
|
|
|
echo "file_crc":${file_crc}"===========save_crc":${save_crc}
|
|
|
|
if [ "${file_crc}" == "${save_crc}" ];then
|
|
umount -l ${sd_mount_dir}
|
|
rmmod exfat;
|
|
exit;
|
|
fi
|
|
|
|
insmod /komod/extdrv/led.ko
|
|
|
|
echo "upgrade_begin" > /proc/rt/led
|
|
|
|
umount -l ${sd_mount_dir}
|
|
|
|
umount -l /etc/ipcamera
|
|
|
|
cp /usr/sbin/upgrade.sh /tmpfs/
|
|
|
|
chmod +x /tmpfs/upgrade.sh
|
|
|
|
/tmpfs/upgrade.sh
|
|
|
|
|
|
|
|
|