Difference between revisions of "Heise Offline-Update"
(Cleaned up the script) |
(added check for more updates required.) |
||
Line 19: | Line 19: | ||
priority="0"> | priority="0"> | ||
− | <check type="file" condition="exists" path="%SystemDrive%\netinst\wpkg\ | + | <check type="file" condition="exists" path="%SystemDrive%\netinst\wpkg\ctupdate.done" /> |
<install cmd='cmd /c %WPKGROOT%\scripts\offlineupdate.cmd' /> | <install cmd='cmd /c %WPKGROOT%\scripts\offlineupdate.cmd' /> | ||
− | + | <install cmd='"%SOFTWARE%\ctcheck.exe"' /> | |
<upgrade cmd='cmd /c %WPKGROOT%\scripts\offlineupdate.cmd' /> | <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\ | + | <remove cmd='cmd /c %WPKGROOT%\tools\rm.exe -f "%SystemDrive%\netinst\wpkg\ctupdate.done"' /> |
</package> | </package> | ||
Line 44: | Line 44: | ||
cmd /c cmd\DoUpdate.cmd >%SystemDrive%\netinst\wpkg\offlineupdate.log | cmd /c cmd\DoUpdate.cmd >%SystemDrive%\netinst\wpkg\offlineupdate.log | ||
popd \\ntinstall\offlineupdate | popd \\ntinstall\offlineupdate | ||
+ | date /T >%SystemDrive%\netinst\wpkg\ctupdate.done | ||
</source> | </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]] | [[category:Silent Installers]] |
Revision as of 04:18, 13 March 2009
Silent installer for Heise Offline-Update.
Download the Offline-Update scripts. Run the downloader and select the products you want updates for. One note: if you're using the Compatibility Pack for the 2007 Office System then download the updates for Office 2007. Those patch the Compatibility Pack as well as Office 2007.
Once all of the downloads are complete copy the contents of the "client" folder to your server. These scripts assume the share name is "offlineupdate" and the server name is "ntinstall". You also need "rm.exe" and "mkdir.exe" from GnuWin32 in your "tools" folder.
Note: I increment the revision each Patch Tuesday. If you want this to run every time wpkg is run add 'execute="always"' to the package tag and disable the reboot.
offlineupdate.xml:
<?xml version="1.0" encoding="UTF-8"?>
<packages>
<package
id="offlineupdate"
name="offlineupdate"
revision="200805131"
reboot="true"
priority="0">
<check type="file" condition="exists" path="%SystemDrive%\netinst\wpkg\ctupdate.done" />
<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\ctupdate.done"' />
</package>
</packages>
offlineupdate.cmd:
@echo off
:: Make sure that the log directly exists and is hidden
%WPKGROOT%\tools\mkdir.exe -p %SystemDrive%\netinst\wpkg
attrib +H %SystemDrive%\netinst
:: Update the system and log it
pushd \\ntinstall\offlineupdate
cmd /c cmd\DoUpdate.cmd >%SystemDrive%\netinst\wpkg\offlineupdate.log
popd \\ntinstall\offlineupdate
date /T >%SystemDrive%\netinst\wpkg\ctupdate.done
Delphi source code for ctcheck.exe (ctcheck.dpr):
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.