[REBOL] Patch for Cerebrus 1.0.3
From: gchiu::compkarori::co::nz at: 17-Nov-2002 11:31
Hi Guys,
Would those running Cerebrus 1.0.3 like to try this patch.
It downloads a 17Kb patch file, applies it to Cerebrus.exe
and creates new-cerebrus.exe.
When new-cerebrus.exe is run, it should copy itself over
cerebrus.exe, and when cerebrus.exe is then run, it
deletes new-cerebrus.exe.
This update facility was supposed to be automatic in 1.0.3
but something broke :( I'm hoping it will work after
this.
1.0.4 adds a cache directory overcoming the problems when
a POP client can not alter the time out period.
Rebol [
file: %patch-file.r
author: "Graham Chiu"
date: 16-November-2002
purpose: {
patches the Cerebrus binary. Patch code based
upon Gabriele Santilli's code.
}
]
patch-File: func [
filename [file!] "cerebrus.exe"
patch [url! file!] "%patchfile.bin"
md5 [url! file!] "%patchfile.md5"
newmd5 [url! file!] "%newfile.md5"
/local original target
] [
calcMD5: func [ binData ] [
return enbase/base checksum/method binData 'md5
16
]
either error? try [
patch: read/binary patch
md5: read md5
newmd5: read newmd5
] [ print "Error reading files"]
[
either equal? md5 calcmd5 patch [
either error? try [ original: read/binary
filename ] [
print [ "file: " filename " not found!" ]
]
[
patch: to-binary decompress patch
clear skip original length? patch
target: original xor patch
either equal? newmd5 calcMD5 target [
write/binary to-file join "new-"
filename target
print rejoin [ "Success - Updated
version is now: " "new-" filename ]
] [
print [ "Patch failed. MD5 should
be: " newmd5 " but patched file is: " calcMD5 target ]
]
]
]
[ print "md5 mismatch on reading patch file"]
]
]
updateCerebrus: does [
patch-file %cerebrus.exe
http://guest:[guest--www--compkarori--com]/cerebrus/downloads/cerebrus103.bin
http://guest:[guest--www--compkarori--com]/cerebrus/downloads/cerebrus103.md5
http://guest:[guest--www--compkarori--com]/cerebrus/downloads/newcerebrus103.md5
]
--
Graham Chiu