[wpkg-users] Window OS Version check?

Paul McGrath J.P.McGrath at leeds.ac.uk
Sat Jan 23 11:04:38 CET 2010


That is a really sophisticated method, I go for the simple method ;-)

Using the logical checks that the OS is a particular version and the bit type matches 32 or 64bit from the registry

<check type='logical' condition 'and'>
   <check type="registry" condition="equals" path="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion" value="6.0" />  
   <check type="registry" condition="equals" path="HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\PROCESSOR_ARCHITECTURE" value="x86" />
</check>

XP = 5.1, Vista = 6.0 and Windows 7 = 6.1
Processor Architecture is use x86 or AMD64, I havent put 64bit OS on an Intel dual core so I dont know that variable

I have separate packages for XP and Vista (32 or 64) but put them all in the same profile and they'll install based on the checks.
Paul
________________________________________
From: wpkg-users-bounces at lists.wpkg.org [wpkg-users-bounces at lists.wpkg.org] On Behalf Of Rainer Meier [r.meier at wpkg.org]
Sent: 23 January 2010 09:51
To: Sean Kennedy
Cc: wpkg-users at lists.wpkg.org
Subject: Re: [wpkg-users] Window OS Version check?

Hi Sean,

On 23.01.2010 09:31, Sean Kennedy wrote:
> How has everyone else handled version checks with wpkg? For example, I
> would install some packages differently in Vista than I would in XP; is
> there a quick and simple way of handling this?

Sure.


> What I'd like to see is a method by which most of the config files stay
> the same, but wpkg check for different package definition files based on
> the OS version it's running on. So I might have acroread.xml, but if it
> runs under 7 it might look for acroread.6.1.7600.xml ( or something ).

Well, for the checks there are multiple possibilities. Personally I usually just
add appropriate checks to the package and use a logical OR grouping. For example:

<check type='logical' condition 'or'>
  <check type='uninstall' condition='exists' path='XP entry' />
  <check type='uninstall' condition='exists' path='Vista entry' />
</check>

This will make WPKG to detect the package to be installed correctly on both
systems depending on system state.

An alternative solution would be to use a check of type "execute" which allows
you to point to a script which performs various checks depending on OS, registry
values or anything else and then returns 0 if the application is correctly
installed or returns 1 if the application is not installed correctly.


Regarding installation commands. I am usually pointing WPKG to execute a script
called "unattended.cmd". This script can of course detect the OS it is running
on and perform the right operations.
You might have a look at my example attached. It's my script to install Internet
Explorer 8.

My package directory includes the following files:
checkIEVersion.cmd:
I am not using this script now but you might use a similar script if you need to
perform extensive checks based on operating system version. So you might call it
within an "execute" type check.

IE8-WindowsVista-x64-DEU.exe:
IE 8 Installer for Vista x64, German

IE8-WindowsVista-x64-ENU.exe:
IE 8 Installer for Vista x64, English

IE8-WindowsVista-x86-DEU.exe:
IE 8 Installer for Vista 32-bit, German

IE8-WindowsVista-x86-ENU.exe:
IE 8 Installer for Vista 32-bit, English

IE8-WindowsXP-x86-DEU.exe:
IE 8 Installer for XP 32-bit, German

IE8-WindowsXP-x86-ENU.exe:
IE 8 Installer for XP 32-bit, English

install.cmd:
My generic installer helper - it's able to run many silent installers.

unattended.cmd:
The script I am calling from WPKG. It detects the language and calls
unattended-[lang].cmd depending on system language. So I can support multiple OS
languages with one script easily.

unattended-de.cmd:
Detects OS version and runs correct installer depending on OS version. German
installers are run from within this script.

unattended-en.cmd:
Detects OS version and runs correct installer depending on OS version. English
installers are run from within this script.

unattended-uninstall.cmd:
Is called by WPKG to uninstall the application.



This set of scripts can be easily adapted to almost any application.

br,
Rainer



More information about the wpkg-users mailing list