copy only new file to flash

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-experimental@1144 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: a9d58b44d9
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2011-02-10 (Thu, 10 Feb 2011)



------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2011-02-10 10:13:18 +00:00
parent 19b862b608
commit f99b0b7587

View File

@@ -1,11 +1,45 @@
#!/bin/sh
# 1st arg is dir where unpack, $2 file to be installed
update_file()
{
FILE_IMAGE=$1
FILE_NEW=$2
MD5NEW=`md5sum $FILE_NEW | cut -d " " -f1`
if [ -e $FILE_IMAGE ]; then
MD5IMG=`md5sum $FILE_IMAGE | cut -d " " -f1`
else
MD5IMG=0
fi
if [ "$MD5NEW" = "$MD5IMG" ]
then
echo "New and old File $FILE_IMAGE identical"
else
echo "update $FILE_IMAGE"
rm -f $FILE_IMAGE
cp $FILE_NEW $FILE_IMAGE
fi
}
cd $1
tar zxvf $2
./temp_inst/ctrl/preinstall.sh $PWD
cp -a ./temp_inst/inst/* /
PAT=$1/temp_inst/inst
len_a=${#PAT}
find $PAT | while read i ;do
if [ -d "$i" ] || [ $(basename "$i") == "boot.bmp.gz" ] || [ $(basename "$i") == "uImage" ];then
continue
fi
NEW_F=$i
len_b=${#NEW_F}
OLD_F=$(echo ${NEW_F:$len_a:$len_b})
update_file $OLD_F $NEW_F
done
./temp_inst/ctrl/postinstall.sh $PWD
rm -rf temp_inst
exit 0