Changes

Jump to: navigation, search

Packages.xml

289 bytes added, 14:58, 17 July 2009
replaced pre with source tags
A basic structure of '''packages.xml''' is as follows:
<presource lang="xml">
<packages>
<package
</packages>
</presource>
This checks for the existence of Adobe Reader within the registry:
<presource lang="xml">
<check type="registry" condition="exists" path="HKLM\Software\Adobe\Adobe Reader\7.0" />
</presource>
This checks to see if Firefox, US English, version 1.5.0.6, is installed:
<presource lang="xml">
<check type="registry" condition="equals" path="HKLM\Software\Mozilla\Mozilla Firefox\CurrentVersion" value="1.5.0.6 (en-US)" />
</presource>
This checks for the existence of Adobe Reader within the filesystem:
<presource lang="xml">
<check type="file" condition="exists" path="%PROGRAMFILES%\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" />
</presource>
This checks to see if Firefox US English version 1.5.0.6 is installed based on the file size of the executable:
<presource lang="xml">
<check type="file" condition="sizeequals" path="%PROGRAMFILES%\Mozilla Firefox\firefox.exe" value="7183469" />
</presource>
This checks whether the version of Firefox .exe that's currently installed is less than 1.5.0.6:
<presource lang="xml">
<check type="file" condition="versionsmallerthan" path="%PROGRAMFILES%\Mozilla Firefox\firefox.exe" value="1.5.0.6" />
</presource>
This checks for the existence of Adobe Reader through the installation list:
<presource lang="xml">
<check type="uninstall" condition="exists" path="Adobe Reader 7.0" />
</presource>
This checks to see if Firefox version 1.5.0.6 is installed in the installation list:
<presource lang="xml">
<check type="uninstall" condition="exists" path="Mozilla Firefox (1.5.0.6)" />
</presource>
running SP2 to be upgraded to Adobe Reader 7.0.8:
<presource lang="xml">
<check type="logical" condition="or">
<check type="registry" condition="exists" path="HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\7.0\Installer\Updates\708" />
<check type="registry" condition="equals" path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CSDVersion" value="Service Pack 1" />
</check>
</presource>
The 2nd condition here might seem counter intuitive, but remember that you're looking for the absence of things rather than the existence of things when you're writing
Typical examples:
<presource lang="xml">
<download url='http://wpkg.example.com/installers/some.msi' target="installers\some.msi" />
<install cmd="msiexec /qn /i %SOFTWARE%\package.msi" />
<install cmd="%comspec% /c copy %SOFTWARE%\file.dll %WINDIR%" />
<remove cmd="msiexec /qn /x %SOFTWARE%\package.msi" />
</presource>
The timeout option ([[Timeouts]]) tells WPKG how long to wait for the command to complete. It is in seconds and the default is 3600 seconds.
If the command you specify returns a value of "0" then wpkg assumes it was successful and continues with the next command, if any. If the command returns a nonzero value, then wpkg stops and logs a failure for the package. Sometimes nonzero exit codes are expected and you want to accept them. You can do this by adding exit code sections inside the install section, like this:
<presource lang="xml">
<install cmd="msiexec /qn /i %SOFTWARE%\package.msi" >
<exit code="0" />
<exit code="259" />
</install>
</presource>
If you don't care about exit code, use <code>exit code="any"</code>:
<presource lang="xml">
<install cmd="msiexec /qn /i %SOFTWARE%\installer.exe /silent" >
<exit code="any" />
</install>
</presource>
You can set a specific reboot action for certain exit codes with something like the following:
<presource lang="xml">
<install cmd="msiexec /qn /i %SOFTWARE%\package.msi" >
<exit code="3010" reboot="true" />
<exit code="0" />
</install>
</presource>
The options for the exit code reboot are:
Other example - WPKG checks if the package is installed only in Windows' Add/Remove Programs before deciding to install it (to make sure it is not installed already):
<presource lang="xml">
<package
id="wpkg3"
</package>
</presource>
This means that WPKG will execute it each time - so this is rather useful for executing scripts that need to be run each time the machine is booted, than installing software:
<presource lang="xml">
<package
id="backupfiles"
<install cmd='\\server\path\script.bat' />
</package>
</presource>
to do one time only, like disk defragmenting, some testing, changing printers etc.
<presource lang="xml">
<package
id="backupfiles"
<install cmd='\\server\path\script.bat' />
</package>
</presource>
Similarly, you may want to execute a program or script each time - use "always" instead of "once". For more info on this functionality, check [[Execute_once_/_always|here]].
Note, if you decide to keep all your packages in separate XML files, still, you need to have <code>packages.xml</code> file. It should at least contain an empty entry:
<presource lang="xml">
<?xml version="1.0" encoding="UTF-8"?>
<packages>
</packages>
</presource>

Navigation menu