From a9d58b44d952b0dc01a4d122a028a93e2f383204 Mon Sep 17 00:00:00 2001 From: satbaby Date: Thu, 10 Feb 2011 10:13:18 +0000 Subject: [PATCH] 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 --- data/scripts/install.sh | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/data/scripts/install.sh b/data/scripts/install.sh index 277f305bc..537da3cf9 100755 --- a/data/scripts/install.sh +++ b/data/scripts/install.sh @@ -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 -