diff options
-rwxr-xr-x | etc/rc.firmware | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/etc/rc.firmware b/etc/rc.firmware index 18788cf..93607d7 100755 --- a/etc/rc.firmware +++ b/etc/rc.firmware @@ -15,32 +15,33 @@ fi binary_update() { TGZ=$1 + rm /tmp/errors mkdir /tmp/patched /tmp/patches cd /tmp/patches - for i in `tar tzf $TGZ | egrep -v "(^\./\.*/$|^\./$|.md5)"`; - do ( - echo "Working on ${i}"; + for i in `tar tzf $TGZ | egrep -v "(^d|_md5)" | nawk '{print $9;}'`; + do + echo "Working on ${i}" # Untar patch file and md5 files - /usr/bin/tar xvzf ${TGZ} ${i} ${i}.old_file_md5 ${i}.new_patch_md5 ${i}.new_file_md5; + /usr/bin/tar xvzf ${TGZ} ${i} ${i}.old_file_md5 ${i}.new_patch_md5 ${i}.new_file_md5 # Apply patch - oldfile newfile patchfile - /usr/local/bin/bspatch /${i} /tmp/patched/${i} /tmp/patches/${i}; - - OLD_FILE_MD5=`cat /tmp/patches/${i}.old_file_md5`; - NEW_PATCH_MD5=`cat /tmp/patches/${i}.new_patch_md5`; - NEW_FILE_MD5=`cat /tmp/patches/${i}.new_file_md5`; - PATCHED_MD5=`/sbin/md5 -q /tmp/patched/${i}`; - if [ "$PATCHED_MD5" = "$NEW_FILE_MD5" ]; then - /bin/mv /tmp/patched/${i} /${i}; + /usr/local/bin/bspatch /${i} /tmp/patched/${i} /tmp/patches/${i} + + OLD_FILE_MD5=`cat /tmp/patches/${i}.old_file_md5` + NEW_PATCH_MD5=`cat /tmp/patches/${i}.new_patch_md5` + NEW_FILE_MD5=`cat /tmp/patches/${i}.new_file_md5` + PATCHED_MD5=`/sbin/md5 -q /tmp/patched/${i}` + + if [ "$PATCHED_MD5" = "$NEW_PATCH_MD5" ]; then + /bin/mv /tmp/patched/${i} /${i} else - echo "${i} file does not match intended final md5."; - echo "${i} file does not match intended final md5." >> /tmp/errors; + echo "${i} file does not match intended final md5." + echo "${i} file does not match intended final md5." >> /tmp/errors fi /bin/rm /tmp/patched/${i} /bin/rm /tmp/patches/${i} - /bin/rm /tmp/patches/${i}.*; - ); + /bin/rm /tmp/patches/${i}.* done } |