Changes

Heise Offline-Update

1,387 bytes added, 04:18, 13 March 2009
added check for more updates required.
priority="0">
<check type="file" condition="exists" path="%SystemDrive%\netinst\wpkg\offlineupdatectupdate.logdone" />
<install cmd='cmd /c %WPKGROOT%\scripts\offlineupdate.cmd' />
<install cmd='"%SOFTWARE%\ctcheck.exe"' />
<upgrade cmd='cmd /c %WPKGROOT%\scripts\offlineupdate.cmd' />
<upgrade cmd='"%SOFTWARE%\ctcheck.exe"' /> <remove cmd='cmd /c %WPKGROOT%\tools\rm.exe -f "%SystemDrive%\netinst\wpkg\offlineupdatectupdate.logdone"' />
</package>
cmd /c cmd\DoUpdate.cmd >%SystemDrive%\netinst\wpkg\offlineupdate.log
popd \\ntinstall\offlineupdate
date /T >%SystemDrive%\netinst\wpkg\ctupdate.done
</source>
Delphi source code for ctcheck.exe (ctcheck.dpr):
 
<source lang="pascal">
program ctcheck;
{$APPTYPE CONSOLE}
{
This program loads the ctupdate log file, then checks for the word "recall" in the last non-empty line.
If the word "recall" is found it then deletes the "ctupdate.done" file, so that wpkg will run ctupdate again.
}
uses Windows,classes,sysutils;
 
function GetDrv(): string;
const
s = 'SYSTEMDRIVE';
var
BufSize: Integer;
begin
BufSize := GetEnvironmentVariable(PChar(s), nil, 0);
if BufSize > 0 then
begin
SetLength(Result, BufSize - 1);
GetEnvironmentVariable(PChar(s),
PChar(Result), BufSize);
end
else
Result := '';
end;
 
var
s:String;
fpath:String;
sl:TStringList;
begin
sl := TStringList.Create;
try
fpath := getDrv() + '\netinst\wpkg\';
sl.LoadFromFile(fpath + 'offlineupdate.log');
while(sl.Count > 0) and(trim(sl[sl.Count -1]) = '')do
sl.Delete(sl.Count -1);
if(sl.Count > 0) then
begin
s := sl[sl.Count -1];
if(AnsiPos('recall', LowerCase(s)) > 0)
then
begin
if not(DeleteFile( fpath + 'ctupdate.done')) then Halt(1);
end;
end
else Halt(1);
except
end;
sl.Free;
end.
</source>
[[category:Silent Installers]]
117
edits