0
edits
Changes
initial submission
== Variables ==
=== Where can they be set ===
* At operating system level
* Through WPKG client
* At the host definition
* At the profile definition
* At the package definition
=== In which order are they applied ===
The level below another will overwrite the previous definition.
# operating system
# WPKG client
# package
# profile
# host
For example, if a variable is defined at the package and the profile level, the definition of the profile will be used.
<source lang="xml">
<profile id="TestPC">
<variable name="PKG_VER" value="1.2.3"/>
<package package-id="WpkgSettings"/>
</profile>
</source>
<source lang="xml">
<package
id="WpkgSettings"
name="WPKG Client Settings"
revision="%PKG_VER%"
priority="999"
reboot="false"
execute="once">
<variable name="PKG_VER" value="1.2.0"/>
</package>
</source>
== Why use variables ==
* To easily change multiple occurrences of a value in the install, upgrade, downgrade and remove commands
* To apply different versions of a package based on host groups and profiles
=== Replacing multiple occurrences ===
<source lang="xml">
<package id="WpkgClient"
name="WPKG Client"
revision="%PKG_VER%"
reboot="false"
priority="999">
<variable name="PKG_VER" value="1.3.14" />
<variable name="PKG_EXE_VER" value="1.0.0.22" />
<check type="uninstall" condition="versiongreaterorequal" path="WPKG" value="%PKG_VER%"/>
<check type="file" condition="versiongreaterorequal" path="%ProgramFiles%\wpkg\wpkginst.exe" value="%PKG_EXE_VER%" />
<!-- replace x32 with x86 and x64 with AMD64 in the installer file name -->
<install cmd='msiexec /norestart /passive /log "%TMP%\WpkgClient.log" /i "%SOFTWARE%\WPKG\WPKG Client\WPKG Client %PKG_VER%-%PROCESSOR_ARCHITECTURE%.msi" ALLUSERS=1 SETTINGSFILE="%WPKG_ROOT%\settings.xml"' >
<exit code="1641" />
<exit code="3010" reboot="false"/>
</install>
<upgrade cmd='msiexec /norestart /passive /log "%TMP%\WpkgClient.log" /i "%SOFTWARE%\WPKG\WPKG Client\WPKG Client %PKG_VER%-%PROCESSOR_ARCHITECTURE%.msi" ALLUSERS=1 SETTINGSFILE="%WPKG_ROOT%\settings.xml"' >
<exit code="1641" />
<exit code="3010" reboot="false"/>
</upgrade>
<remove cmd='MsiExec.exe /norestart /passive /log "%TMP%\WpkgClient.log" /x "%SOFTWARE%\WPKG\WPKG Client\WPKG Client %PKG_VER%-%PROCESSOR_ARCHITECTURE%.msi"' />
</package>
</source>
=== Applying different versions ===
Below find the host definition for two computers, where TestPC is overwriting some variables.
<source lang="xml">
<host name="TestPC" profile-id="DesktopPC" >
<variable name="PKG_VER" value="1.3.14" />
<variable name="PKG_EXE_VER" value="1.0.0.22" />
</host>
<host name="OfficePC" profile-id="DesktopPC" />
</source>
Both computers use the same profile.
<source lang="xml">
<profile id="DesktopPC">
<package package-id="WpkgClient"/>
</profile>
</source>
Both computers use the same package.
<source lang="xml">
<package id="WpkgClient"
name="WPKG Client"
revision="%PKG_VER%"
reboot="false"
priority="999">
<variable name="PKG_VER" value="1.3.9" />
<variable name="PKG_EXE_VER" value="1.0.0.18" />
<check type="uninstall" condition="versiongreaterorequal" path="WPKG" value="%PKG_VER%"/>
<check type="file" condition="versiongreaterorequal" path="%ProgramFiles%\wpkg\wpkginst.exe" value="%PKG_EXE_VER%" />
<!-- replace x32 with x86 and x64 with AMD64 in the installer file name -->
<install cmd='msiexec /norestart /passive /log "%TMP%\WpkgClient.log" /i "%SOFTWARE%\WPKG\WPKG Client\WPKG Client %PKG_VER%-%PROCESSOR_ARCHITECTURE%.msi" ALLUSERS=1 SETTINGSFILE="%WPKG_ROOT%\settings.xml"' >
<exit code="1641" />
<exit code="3010" reboot="false"/>
</install>
<upgrade cmd='msiexec /norestart /passive /log "%TMP%\WpkgClient.log" /i "%SOFTWARE%\WPKG\WPKG Client\WPKG Client %PKG_VER%-%PROCESSOR_ARCHITECTURE%.msi" ALLUSERS=1 SETTINGSFILE="%WPKG_ROOT%\settings.xml"' >
<exit code="1641" />
<exit code="3010" reboot="false"/>
</upgrade>
<remove cmd='MsiExec.exe /norestart /passive /log "%TMP%\WpkgClient.log" /x "%SOFTWARE%\WPKG\WPKG Client\WPKG Client %PKG_VER%-%PROCESSOR_ARCHITECTURE%.msi"' />
</package>
</source>
In the end the computer '''OfficePC gets revision 1.3.9''' of the package installed, where '''TestPC gets revision 1.3.14''' installed.
[[category:Documentation]]
=== Where can they be set ===
* At operating system level
* Through WPKG client
* At the host definition
* At the profile definition
* At the package definition
=== In which order are they applied ===
The level below another will overwrite the previous definition.
# operating system
# WPKG client
# package
# profile
# host
For example, if a variable is defined at the package and the profile level, the definition of the profile will be used.
<source lang="xml">
<profile id="TestPC">
<variable name="PKG_VER" value="1.2.3"/>
<package package-id="WpkgSettings"/>
</profile>
</source>
<source lang="xml">
<package
id="WpkgSettings"
name="WPKG Client Settings"
revision="%PKG_VER%"
priority="999"
reboot="false"
execute="once">
<variable name="PKG_VER" value="1.2.0"/>
</package>
</source>
== Why use variables ==
* To easily change multiple occurrences of a value in the install, upgrade, downgrade and remove commands
* To apply different versions of a package based on host groups and profiles
=== Replacing multiple occurrences ===
<source lang="xml">
<package id="WpkgClient"
name="WPKG Client"
revision="%PKG_VER%"
reboot="false"
priority="999">
<variable name="PKG_VER" value="1.3.14" />
<variable name="PKG_EXE_VER" value="1.0.0.22" />
<check type="uninstall" condition="versiongreaterorequal" path="WPKG" value="%PKG_VER%"/>
<check type="file" condition="versiongreaterorequal" path="%ProgramFiles%\wpkg\wpkginst.exe" value="%PKG_EXE_VER%" />
<!-- replace x32 with x86 and x64 with AMD64 in the installer file name -->
<install cmd='msiexec /norestart /passive /log "%TMP%\WpkgClient.log" /i "%SOFTWARE%\WPKG\WPKG Client\WPKG Client %PKG_VER%-%PROCESSOR_ARCHITECTURE%.msi" ALLUSERS=1 SETTINGSFILE="%WPKG_ROOT%\settings.xml"' >
<exit code="1641" />
<exit code="3010" reboot="false"/>
</install>
<upgrade cmd='msiexec /norestart /passive /log "%TMP%\WpkgClient.log" /i "%SOFTWARE%\WPKG\WPKG Client\WPKG Client %PKG_VER%-%PROCESSOR_ARCHITECTURE%.msi" ALLUSERS=1 SETTINGSFILE="%WPKG_ROOT%\settings.xml"' >
<exit code="1641" />
<exit code="3010" reboot="false"/>
</upgrade>
<remove cmd='MsiExec.exe /norestart /passive /log "%TMP%\WpkgClient.log" /x "%SOFTWARE%\WPKG\WPKG Client\WPKG Client %PKG_VER%-%PROCESSOR_ARCHITECTURE%.msi"' />
</package>
</source>
=== Applying different versions ===
Below find the host definition for two computers, where TestPC is overwriting some variables.
<source lang="xml">
<host name="TestPC" profile-id="DesktopPC" >
<variable name="PKG_VER" value="1.3.14" />
<variable name="PKG_EXE_VER" value="1.0.0.22" />
</host>
<host name="OfficePC" profile-id="DesktopPC" />
</source>
Both computers use the same profile.
<source lang="xml">
<profile id="DesktopPC">
<package package-id="WpkgClient"/>
</profile>
</source>
Both computers use the same package.
<source lang="xml">
<package id="WpkgClient"
name="WPKG Client"
revision="%PKG_VER%"
reboot="false"
priority="999">
<variable name="PKG_VER" value="1.3.9" />
<variable name="PKG_EXE_VER" value="1.0.0.18" />
<check type="uninstall" condition="versiongreaterorequal" path="WPKG" value="%PKG_VER%"/>
<check type="file" condition="versiongreaterorequal" path="%ProgramFiles%\wpkg\wpkginst.exe" value="%PKG_EXE_VER%" />
<!-- replace x32 with x86 and x64 with AMD64 in the installer file name -->
<install cmd='msiexec /norestart /passive /log "%TMP%\WpkgClient.log" /i "%SOFTWARE%\WPKG\WPKG Client\WPKG Client %PKG_VER%-%PROCESSOR_ARCHITECTURE%.msi" ALLUSERS=1 SETTINGSFILE="%WPKG_ROOT%\settings.xml"' >
<exit code="1641" />
<exit code="3010" reboot="false"/>
</install>
<upgrade cmd='msiexec /norestart /passive /log "%TMP%\WpkgClient.log" /i "%SOFTWARE%\WPKG\WPKG Client\WPKG Client %PKG_VER%-%PROCESSOR_ARCHITECTURE%.msi" ALLUSERS=1 SETTINGSFILE="%WPKG_ROOT%\settings.xml"' >
<exit code="1641" />
<exit code="3010" reboot="false"/>
</upgrade>
<remove cmd='MsiExec.exe /norestart /passive /log "%TMP%\WpkgClient.log" /x "%SOFTWARE%\WPKG\WPKG Client\WPKG Client %PKG_VER%-%PROCESSOR_ARCHITECTURE%.msi"' />
</package>
</source>
In the end the computer '''OfficePC gets revision 1.3.9''' of the package installed, where '''TestPC gets revision 1.3.14''' installed.
[[category:Documentation]]