Variable setting through hosts/profiles/packages

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search

Imagine having several research groups using WPKG. This can raise a few difficulties - some have different licence keys etc. To get around this, it is possible to allow variables to be defined in hosts.xml, profiles.xml and packages.xml.

To take an example, say most people use a licence number of 1234 but there are some others who need 6789. We might be able to define the package as:

<package id='test' name='testpackage'>
<variable name='testlicencenumber' value='1234'/>
<install cmd='setup.exe /licence=%testlicencenumber%'/>

which defines a default licence number.

If we have a profile which needs a different value, we set:

<profile id='others'>
<variable name='testlicencenumber' value='6789' />
<package package-id='test'/>

This setting of the variable in the profile over-rides that set in the package.

Likewise, a variable set in hosts.xml over-rides any set in profiles or packages so we can accommodate an individual host using a licence number "abcd" by:

<host name='pcn12' profile-id='others'>
<variable name='testlicencenumber' value='abcd' />

Note: this feature is available in WPKG 0.9.12 and later.