f4e5ebffbe26b6018f19fd9f6805cd1173876c7b
[pandora-misc.git] / flasher / rootfs / etc / init.d / rc
1 #!/bin/sh
2
3 . /etc/updater_funcs.sh
4
5 chvt $LOG_TTY
6 log "Starting updater. Press Alt+right for verbose output.."
7 log ""
8
9 # wait a bit for things to settle..
10 sleep 2
11
12 echo running update script..
13
14 { /etc/updater.sh 2>&1; echo $? > /tmp/update.result; } | tee /tmp/update.log
15 if [ `cat /tmp/update.result` = "0" ]
16 then
17         log "---------------------------------------------"
18         log "Update FINISHED"
19         log "---------------------------------------------"
20 else
21         log "---------------------------------------------"
22         log "Update FAILED"
23         log "---------------------------------------------"
24         mkdir -p /mnt/log 2> /dev/null
25         if mount /dev/mmcblk0p1 /mnt/log
26         then
27                 if touch /mnt/log/update.log
28                 then
29                         dmesg > /mnt/log/update.log
30                         echo "----------" >> /mnt/log/update.log
31                         cat /tmp/update.log >> /mnt/log/update.log
32                         log "update.log saved to SD."
33                 fi
34                 umount /mnt/log
35         fi
36 fi
37 echo "press Enter to power off" > $LOG_DEVICE
38 sync
39 read a < $LOG_DEVICE
40 if [ "$a" != "n" ]
41 then
42         sync
43         echo poweroff
44         poweroff -f
45 fi