Changeset 345

Show
Ignore:
Timestamp:
07/03/09 04:13:39 (5 months ago)
Author:
hardert
Message:

Fix error trapping and output warnings/success messages that fit the
OSWALD's small terminal size

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/software/rootfs/flash.sh

    r343 r345  
    55# the inserted SD card in the root directory. 
    66 
     7# Exit if any command exits with a non-zero status 
     8set -o errexit 
     9 
     10trap errorhandler 0 1 2 3 15 
     11 
     12errorhandler() { 
     13        echo -e "\n" 
     14        echo "WARNING: An error may have occurred while flashing" 
     15        echo "the NAND with the new root filesystem. The SD card" 
     16        echo "may be bad if the untarring process segfaulted or" 
     17        echo "the system might not have tar installed with bzip2" 
     18        echo "support if the process never started." 
     19        if [ -n "$(grep /media/nand /proc/mounts)" ] ; then 
     20                umount /media/nand 
     21        fi 
     22        exit 1 
     23} 
     24 
    725flash_eraseall -j /dev/mtd4 
    8 mkdir /media/nand 
     26[ -d /media/nand ] || mkdir /media/nand 
    927mount -t jffs2 /dev/mtdblock4 /media/nand 
    10 if ! tar jxvf /media/mmcblk0p2/rootfs.tar.bz2 -C /media/nand ; then 
    11         echo "An error occurred while flashing the NAND with the new root filesystem." 
    12         echo "The SD card may be bad if the untarring process segfaulted or the system" 
    13         echo "might not have tar installed with bzip2 support if the process never started." 
    14 else 
    15         echo "default-on" > /sys/class/leds/oswaldboard\:\:usr/trigger 
    16         echo "SUCCESS: The device has been flashed with a new root filesystem. The SD" 
    17         echo "         card should now be removed before turning off the device." 
    18 fi 
     28tar jxvf /media/mmcblk0p2/rootfs.tar.bz2 -C /media/nand 
    1929umount /media/nand 
     30echo "default-on" > /sys/class/leds/oswaldboard\:\:usr/trigger 
     31echo "SUCCESS: The device has been flashed with a new" 
     32echo "root filesystem. The SD card should now be " 
     33echo "removed before turning off the device."