Changes

Jump to: navigation, search

Packages.xml

7,791 bytes added, 06:58, 2 September 2006
packages.xml structure
A basic structure of '''packages.xml''' is as follows:
<blockquote style="background: white; border: 1px solid black; padding: 1em; font-family: fixed, monospace; font-size: 12pt;">
<packages><br>
<br>
 == Check conditions / check type.<br>==  
Of course it would be unwise to launch the installer if the software is already installed. That's why there are "check conditions".
 
Check conditions are broken down into 3 categories:
 
 
<ul>
<li>'''Registry''' - Checks the registry for conditions
<li>'''File''' - Verifies various information about files within the filesystem
<li>'''Uninstall''' - Checks the software installation registry key for the existence of an existing package
</ul>
 
 
'''Registry'''
 
Registry checks allow you to check for the existence of or a specific value in a registry key. There are two possible conditions available for registry checks: ''exists'' and ''equals''.
 
<div style="margin-left: 30px">
'''exists''' - This checks for the existence of a registry key. If the registry key is found, the condition returns true, otherwise it returns false.
 
'''equals''' - This checks a specific value of a registry key. If the registry value is found and that value is equal to the supplied value, the condition returns true, otherwise it returns false.
</div>
 
Examples:
 
This checks for the existence of Adobe Acrobat Reader within the registry:
 
<blockquote style="background: white; border: 1px solid black; padding: 1em; font-family: fixed, monospace; font-size: 12pt;">
<check type="registry" condition="exists" path="HKLM\Software\Adobe\Adobe Reader\7.0" />
</blockquote>
 
This checks to see if Firefox US English version 1.5.0.6 is installed:
 
<blockquote style="background: white; border: 1px solid black; padding: 1em; font-family: fixed, monospace; font-size: 12pt;">
<check type="registry" condition="equals" path="HKLM\Software\Mozilla\Mozilla Firefox\CurrentVersion" value="1.5.0.6 (en-US)" />
</blockquote>
 
 
'''File'''
 
File checks allow you to check for the existence of a file, check for a particular file's size, or examine version information about a file. There are several possible conditions available for registry checks: ''exists'', ''sizeequals'', ''versionsmallerthan'', ''versionlessorequal'', ''versionequalto'', ''versiongreaterorequal'', and ''versiongreaterthan''.
 
<div style="margin-left: 30px">
'''exists''' - This checks for the existence of a file. If the file is found, the condition returns true.
 
'''sizeequals''' - This checks the size of a file. If the file is found and the size equals the value supplied, the condition returns true.
 
'''versionsmallerthan''' - This checks the version of a particular file. If the file is found and the version is less than the supplied version number, the condition returns true.
 
'''versionlessorequal''' - This checks the version of a particular file. If the file is found and the version is less than or equal to the supplied version number, the condition returns true.
 
'''versionequalto''' - This checks the version of a particular file. If the file is found and the version is equal to the supplied version number, the condition returns true.
 
'''versiongreaterorequal''' - This checks the version of a particular file. If the file is found and the version is greater than or equal to the supplied version number, the condition returns true.
 
'''versiongreaterthan''' - This checks the version of a particular file. If the file is found and the version is greater than the supplied version number, the condition returns true.
</div>
 
Examples:
 
This checks for the existence of Adobe Acrobat Reader within the filesystem:
 
<blockquote style="background: white; border: 1px solid black; padding: 1em; font-family: fixed, monospace; font-size: 12pt;">
<check type="file" condition="exists" path="C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" />
</blockquote>
 
This checks to see if Firefox US English version 1.5.0.6 is installed based on the file size of the executable:
 
<blockquote style="background: white; border: 1px solid black; padding: 1em; font-family: fixed, monospace; font-size: 12pt;">
<check type="registry" condition="sizeequals" path="C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" value="7183469" />
</blockquote>
 
This checks whether the version of Firefox that's currently installed is less than 1.5.0.6:
 
<blockquote style="background: white; border: 1px solid black; padding: 1em; font-family: fixed, monospace; font-size: 12pt;">
<check type="registry" condition="versionsmallerthan" path="C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" value="1.5.0.6" />
</blockquote>
 
 
'''Uninstall'''
 
Uninstall checks allow you to check the Microsoft software installation registry keys for the existence of a particular package. Microsoft maintains the list
of applications installed and available for uninstallation in the HKLM\Software\Microsoft\Current Version\Uninstall registry key. The value in the DisplayName key of a
particular package is what's matched by this check. The only condition available for this option is ''exists''.
 
<div style="margin-left: 30px">
'''exists''' - This checks for the existence of the particular software package in the installation database. If the package is found, the condition returns true.
</div>
 
Examples:
 
This checks for the existence of Adobe Acrobat Reader through the installation database:
 
<blockquote style="background: white; border: 1px solid black; padding: 1em; font-family: fixed, monospace; font-size: 12pt;">
<check type="uninstall" condition="exists" path="Adobe Reader 7.0" />
</blockquote>
 
This checks to see if Firefox version 1.5.0.6 is installed in the installation database:
 
<blockquote style="background: white; border: 1px solid black; padding: 1em; font-family: fixed, monospace; font-size: 12pt;">
<check type="registry" condition="exists" path="Mozilla Firefox (1.5.0.6)" />
</blockquote>
 
 
'''Logical Conditions'''
 
There can be zero or more conditions verified during the existence checks. If no conditions are supplied, WPKG attempts to install the package regardless of whether it's currently
installed or not. To facilitate using more than one condition, there is a 4th type of condition that can be added, called the logical condition. Logical conditions allow you to create
multiple conditions while checking for the presence of an existing package. Logical conditions are top level conditions, with the real check conditions as subnodes in the XML.
 
The following logical conditions are available: ''not'', ''and'', ''or'', ''atleast'', and ''atmost''.
 
Examples:
 
Let's say, for the sake of argument, that you have an Adobe Acrobat 7.0.8 package that you want installed, but you only want it installed on workstations
that are running Windows XP Service Pack 2 or higher, due to some strange incompatibility. Let's also say that some workstations can't be
upgraded to Windows XP Service Pack 2 until those workstations are upgraded from 256MB of memory to 512MB of memory. For a scenario like this, you could
(and probably should!) use multiple profiles and have those SP1 workstations in one profile, while the SP2 workstations are in another. However, just
for example purposes, let's say all workstations are in a single profile. You can provide a logical condition in order for only those workstations
running SP2 to be upgraded to Adobe Acrobat 7.0.8:
 
<blockquote style="background: white; border: 1px solid black; padding: 1em; font-family: fixed, monospace; font-size: 12pt;">
<check type="logical" condition="or">
<div style="margin-left: 30px">
<check type="registry" condition="exists" path="HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader\7.0\Installer\Updates\708" />
</div>
<div style="margin-left: 30px">
<check type="registry" condition="equals" path="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CSDVersion" value="Service Pack 1" />
</div>
</check>
</blockquote>
 
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
check conditions. What the above condition says is "Is Adobe Acrobat 7.0.8 installed or is Service Pack 1 installed? If either of these conditions equates to true,
the installation will be skipped. In this particular case, Acrobat 7.0.8 isn't installed, but the value of CSDVersion is Service Pack 1 (for the SP1 boxes)
so the software will not be installed.
 
 
Once all conditions have been tested, if the final result of the conditions is equal to false, WPKG will try to execute the "'''install cmd'''".
There are three check conditions: "'''registry'''" (checks the registry), "'''file'''" (checks for a presence of a file) and "'''uninstall'''" - checks in Software Add/Remove.
<br>
This means: if the "'''registry'''" condition is not met (i.e., the specified registry entry doesn't exist), or, "'''file'''" condition is not met (i.e., that file doesn't exist), or, "'''uninstall'''" condition is not met (i.e., software is not listed in Software Add/Remove), WPKG will try to execute "'''install cmd'''".
<br>
After it's executed, WPKG will check the exit code (should be 0 in this example) '''*and*''' verify all the checks.
<br> 
If '''*any*''' of the checks are not met, software is considered '''*not*''' installed - so enter these values carefully!
<br> 
Remember that you don't have to specify all three check conditions, usually one is enough: if the software you are about to install will show up in Software Add/Remove, it is sufficient to specify just "'''uninstall'''" check.
4
edits

Navigation menu