summaryrefslogtreecommitdiffstats
path: root/etc/rc.firmware
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2005-04-10 18:32:10 +0000
committerScott Ullrich <sullrich@pfsense.org>2005-04-10 18:32:10 +0000
commitc92a7bbfc4e01840da7b08b72577df35361cb738 (patch)
treec2daa45bc12b9cd044abd50fdd40137dae441a7b /etc/rc.firmware
parent222494afb5b97170ac99ed8bb05d9ba9865074b2 (diff)
downloadpfsense-c92a7bbfc4e01840da7b08b72577df35361cb738.zip
pfsense-c92a7bbfc4e01840da7b08b72577df35361cb738.tar.gz
* Check final outputted md5 against what the md5 should be
* Alert the user if the md5 is not the same * Note the error in /tmp/errors
Diffstat (limited to 'etc/rc.firmware')
-rwxr-xr-xetc/rc.firmware26
1 files changed, 24 insertions, 2 deletions
diff --git a/etc/rc.firmware b/etc/rc.firmware
index a7fc157..2752714 100755
--- a/etc/rc.firmware
+++ b/etc/rc.firmware
@@ -106,6 +106,28 @@ esac
binary_update() {
TGZ=$1
- cd /tmp/
- for i in `tar tf $TGZ`; do (tar xvzf $TGZ $i; cp /$i bspatch $i /i$; rm $i); done
+ mkdir /tmp/patched
+ cd /tmp/patched
+ for i in `tar tzf $TGZ | egrep -v "(^\./\.*/$|^\./$|.md5)"`;
+ do (
+ bspatch /$i /tmp/$i /tmp/patched/$i;
+ echo Working on $i;
+ tar xvzf $TGZ $i;
+ tar xvzf $TGZ.old_file_md5 $i.old_file_md5;
+ tar xvzf $TGZ.new_patch_md5 $i.new_patch_md5;
+ tar xvzf $TGZ.new_file_md5 $i.new_file_md5;
+ OLD_FILE_MD5=`cat /tmp/$i.old_file_md5`;
+ NEW_PATCH_MD5=`cat /tmp/$i.new_patch_md5`;
+ NEW_FILE_MD5=`cat /tmp/$i.new_file_md5`;
+ PATCHED_MD5=`md5 /tmp/patched/$i | cut -d" " -f4`;
+ if [ "$PATCHED_MD5" = "$NEW_FILE_MD5" ]; then
+ 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;
+ fi
+ rm $i.*;
+ rm $i
+ );
+ done
}
OpenPOWER on IntegriCloud