rcS.swupdate 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/bin/sh
  2. PATH=/sbin:/bin:/usr/sbin:/usr/bin
  3. USB=/mnt/card
  4. umask 022
  5. mount -t proc proc /proc
  6. mount sysfs /sys -t sysfs
  7. if [ -e /proc/cpu/alignment ]; then
  8. echo "3" > /proc/cpu/alignment
  9. fi
  10. mount tmpfs -t tmpfs $TMPDIR -o,size=40k
  11. echo 0 > /proc/sys/kernel/printk
  12. mount_usb() {
  13. found=0
  14. for i in /dev/sda?;do
  15. if [ $i == "/dev/sda?" ];then
  16. break
  17. fi
  18. mount $i ${USB} 2>/dev/null
  19. if [ $? != 0 ];then
  20. continue
  21. fi
  22. return 0
  23. done
  24. # Try to mount a USB without partition table
  25. mount /dev/sda ${USB} 2>/dev/null
  26. return $?
  27. }
  28. rotation=0
  29. if [ -e /etc/rotation ]; then
  30. read rotation < /etc/rotation
  31. fi
  32. # wait until the device node is created
  33. reset
  34. echo "Checking for application software"
  35. echo "---------------------------------"
  36. echo " "
  37. cp /etc/fw_env.config /tmp/.
  38. while [ 1 ];do
  39. echo "Waiting for USB Pen..."
  40. sleep 3
  41. mount_usb
  42. if [ $? == 0 ];then
  43. break
  44. fi
  45. done
  46. if [ -f ${USB}/software*.img ];then
  47. found=1
  48. break
  49. fi
  50. if [ $found == 0 ];then
  51. echo "No Software Image found....exiting !"
  52. fi
  53. for file in ${USB}/software*.img;do
  54. echo " "
  55. echo "Starting Software Update"
  56. echo "------------------------"
  57. echo Image found : $file
  58. echo " "
  59. swupdate -i $file -v
  60. if [ $? == 0 ];then
  61. echo "SUCCESS !"
  62. else
  63. echo "FAILURE !"
  64. fi
  65. sleep 5
  66. break
  67. done
  68. console=`cat /sys/class/tty/console/active`
  69. echo "console is $console"
  70. if [ x$console != "xttyO0" ];then
  71. while [ 1 ]; do
  72. echo "Please reboot the system !"
  73. sleep 90
  74. reboot
  75. done
  76. fi
  77. /bin/sh
  78. exit 0