#!/bin/sh
# $1 is absolute path of flash directory where tar file will be extracted
# $2 is absolute path of tar file to flash
current_dir=$PWD
cd $1
active_blk=`nv getenv sw_commit | sed s/sw_commit=//g`
if [ $active_blk -eq 1 ]; then
        echo "choosen 0 to flash"
        rfs=0
else
        echo "choosen 1 to flash"
        rfs=1
fi
./fwu.sh $rfs $2
if [ $? -eq 0 ]; then
        nv setenv sw_commit $rfs
fi
cd $current_dir
