Difference between revisions of "Package Templates"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
(New page: Package templates are useful for groups of almost identical packages, e.g. Windows Hotfixes. Templates can be defined by leveraging XML entities to parameterize the boilerplate definition...)
 
(added category)
 
Line 18: Line 18:
  
 
Now those files still only differ in the KB number, but it only appears once reducing the risk of copy and paste errors.
 
Now those files still only differ in the KB number, but it only appears once reducing the risk of copy and paste errors.
 +
 +
[[Category:Silent installers for Windows Hotfixes]]

Latest revision as of 15:54, 16 June 2009

Package templates are useful for groups of almost identical packages, e.g. Windows Hotfixes. Templates can be defined by leveraging XML entities to parameterize the boilerplate definition of such packages. Make sure to save any templates outside the packages/ directory in order not to confuse WPKG. A dedicated templates/ directory might be appropriate. Here is an example template for install-only packages for Windows Hotfixes (watch out for the language tag):

<package id='xp-kb&kb-number;' name='Windows XP KB&kb-number;'>
    <check type='registry' condition='equals'
        path='HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Hotfix\KB&kb-number;\Installed' value='1' />
    <install cmd='"%SOFTWARE%\hotfix\windowsxp-kb&kb-number;-x86-enu.exe" /quiet /norestart /nobackup'>
        <exit code='3010' reboot='postponed' />
    </install>
</package>

This way, adding a new hotfix becomes a matter of dropping a file like this into packages/ (assuming the above is called ../templates/xp-update.xml relative to the packages/ directory):

<!DOCTYPE hotfix [ <!ENTITY kb-number "123456"> <!ENTITY xp-update SYSTEM "../templates/xp-update.xml"> ]>
<packages>&xp-update;</packages>

Now those files still only differ in the KB number, but it only appears once reducing the risk of copy and paste errors.