summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-05-01 22:17:23 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-05-01 22:17:23 +0000
commit1d2ac3a5e3c5e76e0f2d3b26f09d542e32d8be69 (patch)
treeb33fe3747b6f5545060edeeb67f3ea5adfcabfe5
parentf4feb493f2a30c65375b5b994471417150ce200c (diff)
downloadpfsense-1d2ac3a5e3c5e76e0f2d3b26f09d542e32d8be69.zip
pfsense-1d2ac3a5e3c5e76e0f2d3b26f09d542e32d8be69.tar.gz
Add md5 support if the site is storing the value.
-rwxr-xr-xetc/rc.initial.firmware_update17
1 files changed, 17 insertions, 0 deletions
diff --git a/etc/rc.initial.firmware_update b/etc/rc.initial.firmware_update
index 74ee6e4..749207e 100755
--- a/etc/rc.initial.firmware_update
+++ b/etc/rc.initial.firmware_update
@@ -38,7 +38,24 @@ switch ($command) {
$url = chop(fgets($fp));
$status = does_url_exist($url);
if($status) {
+ echo "\nFetching file...\n";
exec("fetch -v -o /tmp/firmware.tgz \"$url\"");
+ $status = does_url_exist("$url.md5");
+ if($status) {
+ echo "\nFetching MD5...\n";
+ exec("fetch -v -o /tmp/firmware.tgz.md5 \"$url.md5\"");
+ }
+ if(file_exists("/tmp/firmware.tgz.md5")) {
+ $source_md5 = trim(`cat /tmp/firmware.tgz.md5 | awk '{ print \$4 }'`,"\r");
+ $file_md5 = trim(`md5 /tmp/firmware.tgz | awk '{ print \$4 }'`,"\r");
+ if($source_md5 <> $file_md5) {
+ echo "\nURL MD5: $source_md5";
+ echo "\nDownloaded file MD5: $file_md5";
+ echo "\n\nMD5 checksum does not match. Cancelling upgrade.\n\n";
+ die -1;
+ }
+ echo "\nMD5 checksum matches.\n";
+ }
if(file_exists("/tmp/firmware.tgz"))
do_upgrade("/tmp/firmware.tgz");
} else {
OpenPOWER on IntegriCloud