[wpkg-users] Distinguishing OS version

Bruno CHOQUET bruno.choquet at unicaen.fr
Wed Sep 21 08:51:27 CEST 2011


Something like this...


<profile id='default'>
<package package-id='AdobeReader' os="windows 7" architecture="x64" />
<package package-id='pidgin' os="windows xp" />
</profile>


or

<host name='host-x'
          profile-id='profile-reference'
          os="windows 7"
          ipaddresses="^192\.168\.1\..*"
          domainname="^domain$"
          groups="^group.*$" />



See below :

Complete list of changes since WPKG 1.1.2 release:

=============================================================================== 

= CHANGES FOR 1.2 release
=============================================================================== 


Change notes
============
WPKG Version: 1.2
Author:     : Rainer Meier <skybeam (at) users.sourceforge.net>
Date        : 2011-07-16
Status      : release pending

Changes/fixes visible to the user:

Summary:
- Fixed IP-address match in case 3 "." are used in host matching string.
- Fixed package removal procedure exception in case of /noremove flag is 
used.
- Fixed removal of settings entry in case of /noremove and no package 
checks.
- Allow folders to be checked with file checks.
- Allows recursive search for uninstall entries in registry
- Enhance wrapper.js to use sysnative cmd.exe.
- Disabled recursive registry uninstall checking again due to slow 
execution.
- Closing STDIN when executing commands.
- Extended host matching for OS, IP, domain and groups.
- Fix for crash if interface has no IP bound to it.
- Fix for registry exist checks not returning true.
- Fix for execute test writes null values to the logs.
- Fix included aesthetic break.
- Extended host attribute match for host architecture.
- Extended host attribute match for environment variables.
- Support for host attribute matches in <package/> definitions within 
profiles.
- Small fixes and optimizations.
- New /noDownload switch.
- Fixed debug mode (broken since introduced advanced host checks).
- Added extended host attribute match for package commands.
- Added package pre-check attributes to package nodes.
- Fixed ignore of lcid in package variables.
- Cosmetic fix in extended host matching debug output.
- Allow multiple packages to be installed/removed/upgraded in one-shot.
- Allow variable expansion in file size checks.
- Fix for null-reference exception if package variable did not specify 
lcid.
- Added tabular output to report.pl
- Fixed references to wpkg.org in profiles.xsd
- Fixed change log typos.
- Fixed invalid read of "uninstalldate" attribute.
- Fixed typos in comments within wpkg.js.
- Fixed additional typos in README.
- Minor usage message formatting fixes.
- Added printing of expanded command-line in debug message.
- Fixed adding of packages to local DB if precheck-upgrade=always succeeds.
- Added extended host matching in variables.
- Added lcid matching for all extended host match supported nodes.
- Added host information to local <wpkg /> settings node.
- Using "hostname" now for extended host attribute matching instead of 
"host".
- Fixed LCID extended host matching variable clash.
- Fixed termination of commands which run into timeout.
- Fixed classic host name matching.
- Added support for IA64 architecture.
- Fixed handling of failed commands with variables in path.
- Fixed process termination when command times out.
- Added sample package templates.
- Included updated Firefox example package.
- Included updated sample profile.
- Final release as version 1.2.

NEW: Updated IP matching algorithm to prevent accidental matching if 
regexpor
      host name is used which uses exactly 3 "." within the string.
      Thanks to Stefan Pendl for reporting.
FIX: Fixed package removal procedure in case /noremove flag is set. WPKG 
would
      have failed (exception thrown) in case /noremove was used and a 
package
      is detected NOT to be installed.
FIX: In case /noremove is used and the package does not define any 
checks WPKG
      is unable to detect if the package is still installed or not. 
Previously
      WPKG was assuming that the package is not installed and removed it 
from
      the local settings file. This has been changed. The package will 
now only
      be removed from the settings file if it defines some checks which 
allow
      WPKG to clearly detect that the package is not installed on the 
system.
      So if the package does not define any checks WPKG assumes it's still
      installed on the system and does not remove its entry from the local
      settings file (wpkg.xml).
FIX: Updated "file" type checks to match folders too. Now a check of 
type file
      for condition exist yields true for a patch referring either a 
file or
      a folder.
      Thanks to Joe for reporting.
NEW: WPKG now allows uninstall entries to be defined in sub-nodes of the
      uninstall registry key. I was unable to verify that Windows 
supports such
      entries but as reported RationalPlan Viewer seems to add such a 
sub-node:
      Uninstall\RationalPlan\Viewer.
      There might be other programs doing the same.
      During tests Windows XP and Windows 7 were ignoring such entries 
but now
      WPKG supports these entries now. (NOTE: Disabled again, read below)
NEW: Enhanced wrapper.js to use sysnative directory. The sysnative 
directory
      allows 32-bit programs to access the 64-bit binaries within
      %SystemRoot%\system32\. This way it is not necessary any more to 
copythe
      64-bit version of cmd.exe to the 64-bit\ sub-folder since the 
wrappercan
      launch the locally available 64-bit cmd.exe.
MOD: Disabled recursive uninstall checks again. Reading registry keys
      recursively is very slow with WSH and since there are typically
      many sub-keys within the uninstall locations this causes a very long
      delay each time an uninstall check is used.
      It's recommended to use a registry value check instead of an 
uninstall
      check in order to check for the status of an application which 
puts its
      uninstall entry within a sub-key of the uninstall keys in the 
registry.
MOD: WPKG now closes STDIN when executing external commands. Some 
applications
      seem to wait for STDIN to be closed before they exit. Microsoft 
PowerShell
      seems to be one of the affected applications.
      Since closing STDIN should not have negative effects (WPKG will 
not write
      to STDIN) it's supposed to be safe to close it.
      Thanks to Stéphane Bilqué for reporting.
NEW: Many extensions in host matching. Now a host entry in hosts.xml is 
allowed
      to include the following attributes:
<host name='host-x'
          profile-id='profile-reference'
          os="windows 7"
          ipaddresses="^192\.168\.1\..*"
          domainname="^domain$"
          groups="^group.*$" />
      Note: All special parameters (os, ipaddresses, domainname, groups) 
are
      specified as regular expressions. Especially keep this in mind when
      specifying IP-addresses or any parameter including periods (.). As a
      period in regular expression means "any character". So keep in 
mind to
      escape special regular expression characters.
      Note that the group attribute refers to regular Windows NT group
      membership and not to Active-Directory organization units.
      Many thanks to Daniel Dehennin for continued support of this changes.
      It just almost took as long as finishing DNF to include it. *sigh*
FIX: Included fix for bug 196 which could make WPKG crash in case no IP
      address is assigned to a network card.
      Thanks to Daniel Dehennin again.
FIX: Included fix for bug 199 where registry exist checks did not return 
true.
      Thanks to Daniel Dehennin again.
FIX: Included fix for bug 200 where execute test fallback to 
'exitcodeequalto'
      in 'execute' tests writes null values to the logs.
      Thanks to Daniel Dehennin again.
FIX: Included aesthetic break statement in check condition for uninstall 
checks.
      Thanks to Daniel Dehennin again.
NEW: Extended host attribute match now allows to match architecture using
      architecture="<arc>" attribute. The following architectures are 
currently
      supported:
      x86      32-bit operating system
      x64      64-bit operating system
      Note: You will have to match x86 also if you run Windows 32-bit on
      AMD64/EMT64/x64 hardware.
NEW: Extended host attribute match allows to match environment variables 
using
      environment="variable1=^regexp$|variable2=regexp..." attribute.
      Please note that regular expressions are matched case-insensitive and
      multiple variables have to be separated by the pipe ('|') character.
      Please also note that in case you use WPKG-client the system-user
      environment might differ from the environment you see when opening a
      command prompt and typing 'set'. Some variables might be missing and
      others might have different content. So use with caution.
NEW: Extended use of host matches. Now WPKG supports host matches from 
previous
      update not only in <host /> definitions but also in <package />
      definitions used within <profile /> nodes. This allows profiles where
      certain packages are applied only if specific host-conditions match.
      For example:
<profile id='default'>
<package package-id='AdobeReader' os="windows 7" architecture="x64" />
<package package-id='audacity' />
<package package-id='pidgin' os="windows 7" />
<package package-id='firefox' environment="NUMBER_OF_PROCESSORS=^4$" />
</profile>
      This example would install "AdobeReader" only on systems with 
Windows7
      64-bit edition running while "pidgin" is installed on all Windows 
7 hosts
      regardless of the architecture. The "firefox" package would be 
installed
      only if WPKG runs within an environment which defines the
      NUMBER_OF_PROCESSORS environment variable to the value "4".
      The "audacity" packages would be installed on any host which gets the
      'default' profile assigned.
MOD: Some smaller fixes and optimizations.
NEW: Added /noDownload option (and noDownload property in config.xml) to
      disable downloads globally. When the switch is used then WPKG just 
ignores
      any download specification. Use with caution as your 
install/upgrade/...
      commands might depend on downloaded files. So make sure that you 
fetch
      the files which would be downloaded prior to WPKG execution.
      Thanks to Marco Gaiarin.
FIX: Fixed using of lcid="<lcid>" attribute within variable definition in
      packages. It was documented in packages.xsd but not implemented in 
wpkg.js.
      Fixes bug 206.
      Thanks to Stefan Pendl.
FIX: Fixed bug when using /debug switch (or implicit enable of /debug by 
using
      /dryrun switch or config.xml flag). The issue was introduced with 
newhost
      attribute matching and advanced host identification in debug 
messages.
      Fixes bug 210. Thanks to Stefan Pendl for reporting.
NEW: Extended host attribute verification is now allowed to be used in 
package
      commands too. Commands which specify additional host attributes are
      ignored if one of the extended attributes do not match the 
executing host.
      e.g.
<install cmd="command"
          ...
          os="windows 7"
          ipaddresses="^192\.168\.1\..*"
          domainname="^domain$"
          groups="^group.*$"
          architecture="x86" />
      Note: All special parameters (os, ipaddresses, domainname, groups) 
are
      specified as regular expressions. Especially keep this in mind when
      specifying IP-addresses or any parameter including periods (.). As a
      period in regular expression means "any character". So keep in 
mind to
      escape special regular expression characters.
      As a result you can use extended host check attributes in the 
following
      locations:
      - host matching
<host name="hostname"
              profile-id="profile"
              ...
              architecture="x64"
              ...
        />
      - profile packages
<package package-id="package"
                 ...
                 architecture="x64"
                 ...
        />
      - package commands
<install cmd="command-line"
                 ...
                 architecture="x64"
                 ...
        />
<remove cmd="command-line"
                 ...
                 architecture="x64"
                 ...
        />
<upgrade cmd="command-line"
                 ...
                 architecture="x64"
                 ...
        />
<downgrade cmd="command-line"
                 ...
                 architecture="x64"
                 ...
        />
NEW: Added attributes to package nodes which allow to control whether 
checks
      shall be execute before install/upgrade/downgrade/remove. By 
default WPKG
      only executes checks before first installation in order to prevent 
re-
      installing a package which is already installed. Using the new 
attributes
      it allows you to enable these checks before 
upgrade/downgrade/remove too.
      For example if you use precheck-upgrade="always" and upgrade a 
package,
      then WPKG will first run the checks and if they succeed WPKG will 
skip
      the execution of upgrade commands and just assume this version is 
already
      installed.
      Be careful when using these attributes as it might lead WPKG to skip
      upgrades/downgrades if your checks are not sufficiently specific. For
      example if your check just checks for an uninstall entry existence 
which
      is true for the old and the new version, then 
precheck-upgrade="always"
      would make WPKG believe that the upgrade has been performed 
already as
      the uninstall check from the updated package succeeds. So make 
sure to
      include some checks which are true for the new package, but not 
for the
      old one.
      Here is some documentation on the attributes (all of them are 
optional):
<package ...
          precheck-install="never|always"
          precheck-remove="never|always"
          precheck-upgrade="never|always"
          precheck-downgrade="never|always"
      />
      Notes on "precheck-install":
         Defines how package checks are used during package
         installation.

         Currently supported values:

         "always" (default): When a package is new to the
         host then first the checks are run in order to
         verify whether the package is already installed. If
         the checks succeed then it is assumed that no
         further installation is needed. The package is
         silently added to the host without executing any
         commands.

         "never": When a package is new to the host then the
         install commands are run in any case (without doing
         checks first). Note: Checks will still be done after
         package installation to verify whether installation
         was successful.

      Notes on "precheck-remove":
         Defines how package checks are used during package
         removal.

         Currently supported values:

         "always": When a package is removed from a
         host then the checks will be executed before removal
         is processes. If the checks fail this potentially
         means that the package has been removed already. In
         such case the package remove commands will be
         skipped.

         "never" (default): When a package is about
         to be removed from the host then WPKG will execute
         the remove commands in any case without executing
         the checks first. Note: Checks will still be done
         after package removal to verify whether the removal
         was successful.

      Notes on "precheck-upgrade":
         Defines how package checks are used during package
         upgrade.

         Currently supported values:

         "always": When a package is upgraded the
         checks specified will be be executed before the
         upgrade takes place. If checks succeed, then the
         upgrade will not be performed (WPKG just assumes
         that the new version is already applied correctly.
         Please note that your checks shall verify a specific
         software version and not just a generic check which
         is true for all versions. If your checks are true
         for the old version too then WPKG would never
         perform the upgrade in this mode.

         "never" (default): When a package is about
         to be upgraded then WPKG will execute the upgrade
         commands in any case without executing the checks
         first. This is the recommended behavior. Note:
         Checks will still be done after package upgrade to
         verify whether the upgrade was successful.

      Notes on "precheck-downgrade":
         Defines how package checks are used during package
         downgrade.

         Currently supported values:

         "always": When a package is downgraded the
         checks specified will be be executed before the
         downgrade takes place. If checks succeed, then the
         downgrade will not be performed (WPKG just assumes
         that the old version is already applied correctly.
         Please note that your checks shall verify a specific
         software version and not just a generic check which
         is true for all versions. If your checks are true
         for the new/current version too then WPKG would
         never perform the downgrade in this mode.

"never" (default): When a package is about
         to be downgraded then WPKG will execute the
         downgrade commands in any case without executing the
         checks first. This is the recommended behavior.
         Note: Checks will still be done after package
         downgrade to verify whether the downgrade was
         successful.
      This implements a change request reported in Bugzilla report 180.
FIX: Fixed using of lcid="<lcid>" attribute within variable definition in
      packages. It was documented in packages.xsd but not implemented in 
wpkg.js.
      Fixes bug 206.
      Thanks to Stefan Pendl.
FIX: Fixed cosmetic issue in host matching output.
      Fixes bug 211. Thanks to Stefan Pendl for reporting.
NEW: Allow to specify multiple packages to be installed/removed/upgraded on
      command-line. Just specify a comma-separated list of packages:
      cscript wpkg.js /install:package1,package2,...
      Implements bugzilla 204. Thanks to Michael Croes for reporting.
NEW: Allowing use of environment variables in file size checks:
<check type="file"
             condition="sizeequals"
             path="%ProgramFiles%\%PKG_DST%"
             value="%PKG_SIZE%" />
      Fixes bug report 212. Thanks to Stefan Pendl for reporting.
FIX: Fixed additional issue in package variable LCID matching in case 
variable
      was defined but no lcid attribute was present (which should be fully
      supported).
      Support for multiple comma-separated LCID values added.
      Fixes bug 206.
NEW: Added tabular output for the listing to report.pl script.
      Thanks to Stefan Pendl for providing the update.
      Fixes bug 213.
FIX: Fixed profiles.xsd reference to example.org instead of wpkg.org.
      Thanks to Stefan Pendl for reporting. Fixes bug 214.
FIX: Fixed typos in change log files.
      Thanks to Stefan Pendl for review. Fixes bug 215.
FIX: Fixed minior formatting errors in usage message.
      Fixes bug 220. Thanks to Stefan Pendl.
NEW: Printing command + expanded command in debug message when executing
      commands.
      Fixes bug 221. Thanks to Stefan Pendl.
FIX: Packages which were already updated by the user (detected by
      precheck-update=always) were not added to the local package database.
      As a result such packages were checked over and over again for 
upgrade
      on each WPKG-run.
      Fixes bug 219. Thanks to Heiko Helmle.
NEW: Supporting extended host matching in variables.
      Fixes bug 209. Thanks to Stefan Pendl.
NEW: Added generic lcid matching for all XML elements which support 
extended
      host matching. Now the following attributes can be matched:

      os="windows 7"
      ipaddresses="^192\.168\.1\..*"
      domainname="^domain$"
      groups="^group.*$"
      architecture="x86"
      lcid="407,c07,1407,1007,807"

      These matches can be used within the following XML elements now:

      In hosts.xml:
<host name="..." proifile-id="..." os="..." ... />
<variable name="..." value="..." os="..." ... />

      In profiles.xml:
<variable name="..." value="..." os="..." ... />
<package package-id="..." os="..." ... />

      In packages.xml:
<variable name="..." value="..." os="..." ... />
<install cmd="..." os="..." />
<upgrade cmd="..." os="..." />
<downgrade cmd="..." os="..." />
<remove cmd="..." os="..." />

      Implements request filed in bug 209. Thanks to Stefan Pendl.
NEW: Added host attributes to <wpkg /> node of local settings file 
(wpkg.xml).
      This allows analysis tools to get some more host information without
      having to parse the log files. Example node:
<wpkg
        hostname="admin-pc"
        architecture="x64"
        os="microsoft windows 7 professional, , , 6.1.7600"
        ipaddresses="192.168.1.30"
        domainname=""
        groups=""
        lcid="807"
      />
      Fixes bug 217. Thanks to Stefan Pendl.
      Update: This change did have a huge impact on test cases as wpkg-test
      performs 1:1 comparison to expected wpkg.xml files. As a result 
all checks
      fail. To work-around this issue unless the tests are updated I have
      introduced a configuration switch in config.xml:
        settingsHostInfo=true
      If set to false, then WPKG will not write host attributes to local
      wpkg.xml database.
FIX: Extended host attribute matching uses "hostname" now for host name
      matching to prevent collision with name attributes in <variable />
      nodes. Moreover this allows now to use classical "name=" attribute
      in <host /> nodes as wel as the "hostname" extended match attribute.
      In addition the "name=" attribute in <hosts /> have been declared as
      optional now. This allows to use either legacy "name" matching which
      does direct literal-match, IP-address match and regexp matching as 
well
      as it allows to use extended host match attributes instead.

      E.g. the following constructs are valid...
      Classial host matching:
<host name="hostname" profile-id="p" />

      IP-matching using classical name attribute:
<host name="192.168.1.1-255" profile-id="p" />

      Alternative matching using extended host attributes omitting name
      attribute:
<host ipaddresses="192\.168\.1\..*" profile-id="p" />

      Combining classical matching with extended host matching:
<host name="hostname" os="windows 7" profile-id="p" />
      Fixes additional bugs found in implementation for bug 209.
      Thanks to Stefan Pendl.
FIX: Worked around a WSH issue of variable scopes in for loops.
      Fixes LCID handling of extended host matches.
FIX: Fixed termination of processes if timeout is reached.
      Fixes bug 222. Thanks to Stefan Pendl.
FIX: Fixed bug that "name" attribute in host node was completely ignored in
      previous commits. Fixes classic host-name matching.
NEW: Added support for IA64 Itanium architecture. Basically this adds
      the possibility to use os="ia64" in extended host attribute matching.
      So the current list of supported architectures is:

      x86:  32-bit Windows operating system running on x86 instruction set
      x64:  64-bit Windows operating system running on x86-64 
instruction set
      ia64: 64-bit Windows operating system running on IA64 instruction set

      Fixes bug 224. Thanks to Stefan Pendl for requesting.
FIX: Fixed error handling in case command execution fails AND command 
includes
      variables. In such case WPKG did not properly return code -1 so the
<exit code="any" /> tag did not have any effect.
      Fixes bug 226. Thanks to Bruno Choquet for reporting.
FIX: Fixed call of Terminate() method when command times out in order to
      properly shut down the child process.
NEW: Added sample package templates which might help users to build 
their own
      packages.
      Fixes bug 225. Thanks to Stefan Pendl for sharing the templates.
MOD: Modified included sample packages for firefox and added adobe flash 
player
      example. The new packages give some more insight on new WPKG features
      as provided in WPKG-1.1.3.
      Fixes bug 227. Thanks to Stefan Pendl.
MOD: Modified included example profile to show os attribute.
      Fixes bug 228. Thanks to Stefan Pendl.
NEW: Final release of WPKG 1.1.3-RC16 as WPKG 1.2. No further code changes.

Bruno CHOQUET, responsable du service informatique de l'IUT d'Alençon.
correspondant informatique du site universitaire d'Alençon.
http://www.unicaen.fr/iutalencon
Tel : 02.33.80.85.10


Le 21/09/2011 04:49, Mikhail Joseph Salviejo a écrit :
> Good day to all,
>
> Does anyone knows how am I going to test whether the OS is Windows
> 2000, XP or 7?
>
> The scenario is like this.
>
> I am going  to install Firefox yet some features of the package must
> be not be read
> if its on 2000 system (like for example 2000 does not accept taskkill)
> , yet it must be read by XP&  7.
>
> Computers here are mixed OS some still on 2000, some on 7, and many on XP.
>
> Can anyone help me.
>
> Thank you in advance.
>
> Your Truly
>
> Mikhail Joseph Salviejo
> -------------------------------------------------------------------------
> wpkg-users mailing list archives>>  http://lists.wpkg.org/pipermail/wpkg-users/
> _______________________________________________
> wpkg-users mailing list
> wpkg-users at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/wpkg-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wpkg.org/pipermail/wpkg-users/attachments/20110921/066ba2b5/attachment-0002.html>


More information about the wpkg-users mailing list