diff options
Diffstat (limited to 'recipes-core/initscripts')
-rw-r--r-- | recipes-core/initscripts/initscripts-1.0/umountfs | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/recipes-core/initscripts/initscripts-1.0/umountfs b/recipes-core/initscripts/initscripts-1.0/umountfs index bfd4d47..c782dc7 100644 --- a/recipes-core/initscripts/initscripts-1.0/umountfs +++ b/recipes-core/initscripts/initscripts-1.0/umountfs @@ -50,6 +50,33 @@ blink_leds() { done } +err_leds() { + led_dir=/sys/class/leds + # blink all programmable LEDs except status + leds=$(ls $led_dir/ | grep -v status) + nleds=$(echo "$leds" | wc -w) + + # turn LEDs off + for led in $leds; do + echo "timer" > $led_dir/$led/trigger + echo 0 > $led_dir/$led/delay_off + done + + int=200 + total=$(( int * (nleds+1) )) + on=$(( total - int )) + off=$(( total - on )) + + # make a pattern + for led in $leds; do + echo "$on" > $led_dir/$led/delay_on + echo "$off" > $led_dir/$led/delay_off + done + sleep 5 +} + + + flash_upgrade() { if [ $# -ne 1 ]; then echo "need to specify flash-root" @@ -189,8 +216,16 @@ flash_upgrade() { blink_leds - cp ${reboot_cmd} ${flash_dir}/upgrade-reboot - cp ${nandwrite_cmd} ${flash_dir}/nandwrite.static + if ! cp ${reboot_cmd} ${flash_dir}/upgrade-reboot ; then + echo "Aborting upgrade. Failed \"cp ${reboot_cmd} ${flash_dir}/upgrade-reboot\"" + err_leds + return 1 + fi + if ! cp ${nandwrite_cmd} ${flash_dir}/nandwrite.static ; then + echo "Aborting upgrade. Failed \"cp ${nandwrite_cmd} ${flash_dir}/nandwrite.static\"" + err_leds + return 1 + fi sync sleep 2 mount -o remount,ro ${flash_root} |