[wpkg-users] Deploy different versions of wpkg dependent on XP/Seven

Rainer Meier r.meier at wpkg.org
Tue Nov 16 20:08:04 CET 2010


Hi Zorgman,

On 16.11.2010 18:15, zorgman wrote:
> Hi,
> I'm used to deploy wpkg by a batch script which run wpkg.msi with correct
> setting info ...
> 
> Now i have some old XP and new Seven 64bits, i need to install different version
> of wpkg dependent on OS Version/bits.
> Do you now en easy way to do it? May be a script already exists? I have tried to
> use %OS% environment variable but it returns alway window_NT.

You might point your package to call s small CMD script. E.g. (not tested)

install.cmd:

===========================================================================
@echo off
:: Detect Windows version

:: set default installer
set CMD32=WPKG Client 1.3.6.msi
set CMD64=WPKG Client 1.3.6_64.msi

ver | findstr /i "5\.1\." > nul
IF %ERRORLEVEL% EQU 0 (
    REM Windows XP
    set CMD32=WPKG Client 1.3.5.msi
    set CMD64=WPKG Client 1.3.5_64.msi
)

if not "%ProgramFiles(x86)%" == "" goto 64bit
msiexec /i "%~dp0%CMD32%" /qn
goto end

:64bit
msiexec /i "%~dp0%CMD64%" /qn
goto end

:end
===========================================================================


Such a small and simple script does not only allow you to use different
installers for different OS but it also allows you to use the right installer
for 32-bit and 64-bit OS.

For sure you need to make sure that your checks are valid for all versions which
might be applies. In case of WPKG it's very simple:

<?xml version="1.0" encoding="utf-8" ?>
<packages>

<package id='WPKG' name='WPKG Package management' revision='1' priority='100'
reboot='false' >

  <check type='uninstall' condition='exists' path='WPKG' />

  <install cmd='"%SOFTWARE%\wpkg\install.cmd"' />
  <remove cmd='"%SOFTWARE%\wpkg\uninstall.cmd"' />
  <upgrade cmd='"%SOFTWARE%\wpkg\install.cmd"' />
  <upgrade cmd='"%SOFTWARE%\wpkg\install.cmd"' />
</package>

</packages>


The package just needs to check the "WPKG" uninstall entry (which is the same
for all versions. The install.cmd wrapper will make sure the right version for
the OS it runs on is applied.

This should also answer your question about 64-bit version and %ProgramFiles% vs
%ProgramFiles(x86)%.

br,
Rainer



More information about the wpkg-users mailing list