12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- #!/bin/sh
- case "$ACTION" in
- add|"")
- DATE=`date +%Y-%m-%d_%H:%M:%S`
- result=1
- # cat /dev/null > /Storage/SystemLog/check_upgrade_byUSB
- echo [ $DATE ] /dev/$MDEV detected. >> /Storage/SystemLog/check_upgrade_byUSB
- mount /dev/$MDEV /UsbFlash
- # Check upgrade image list file exist and process upgrade logic
- if [ -f "/UsbFlash/upgrade_image_list" ]; then
- # Copy image file to target
- while read -r filename;
- do
- `cp -f /UsbFlash/$filename /mnt`
- if [ $? -ne 0 ]; then
- result=0
- echo [ $DATE ] copy /UsbFlash/$filename to /mnt fail. >> /Storage/SystemLog/check_upgrade_byUSB
- else
- echo [ $DATE ] copy /UsbFlash/$filename to /mnt success. >> /Storage/SystemLog/check_upgrade_byUSB
- fi
- done < /UsbFlash/upgrade_image_list
- # Trigger upgrade event
- if [ $result -eq 1 ]; then
- echo [ $DATE ] copy all image list on upgrade_image_list to /mnt success and trigger upgrade event. >> /Storage/SystemLog/check_upgrade_byUSB
- `/root/WebService upgrade /mnt/`
- else
- echo [ $DATE ] copy all image list on upgrade_image_list to /mnt occur error. >> /Storage/SystemLog/check_upgrade_byUSB
- fi
- else
- echo [ $DATE ] USB disk can not find upgrade_image_list file >> /Storage/SystemLog/check_upgrade_byUSB
- fi
- umount /dev/$MDEV
- ;;
- esac
|