http://www.newton-inc.com/dev/techinfo/qa/qa.htmSafeRemovePackage().SuckPackageFromEndpoint(), or the store method SuckPackageFromBinary() depending on where the package is coming from.SafeRemovePackage until after you verify (most likely with a deferred call) that the SuckPackageFromEndpoint or SuckPackageFromBinary has succeeded.SafeRemovePackage from a function that's in the target package. You'll need to create a small function which does nothing but remove the old package, and then TotalClone that small function before executing it via a deferred call. Otherwise you'd be chopping your package's legs out from under itself, causing no end of havoc!installscript performs whatever checks are necessary, and then conditionally calls SuckPackageFromBinary, providing the binary object which holds the real package..pkg file that NTK produces into an object in the NewtonScript environment in NTK. On Windows NTK, LoadDataFile does this. On Macintosh NTK, the easiest thing to do is use a utility such as Clipboard Magician to copy the data from the .pkg file into a resource, then use GetNamedResource to get the data in your installer package. GetNamedResource and LoadDataFile are documented in the Newton Toolkit User's Guide. The MonacoTest sample code is a working example of a package installer that uses this technique.func(pkgRef)
begin
local thelen:=extractword(pkgRef,26) div 2 -1;
local s:=" ";
while strlen(s)<thelen do
s:=s&s;
s:=substr(s,0,thelen);
BinaryMunger(s, 0, thelen*2, pkgRef,
52+(extractlong(pkgRef,48)*32)+extractword(pkgRef,24), thelen*2);
s;
end