[wpkg-users] Use regex to get installed version number?

Keith Jones K.E.Jones at brighton.ac.uk
Tue Mar 17 22:01:22 CET 2015


Hi Folks,

> -----Original Message-----
> From: wpkg-users [mailto:wpkg-users-bounces at lists.wpkg.org] On Behalf
> Of Nils Thiele
> Sent: 17 March 2015 11:46
> To: wpkg-users at lists.wpkg.org
> Subject: Re: [wpkg-users] Use regex to get installed version number?
> 
> Am 2015-02-27 00:33, schrieb Stefan Pendl:
> > Am 26.02.2015 um 10:51 schrieb Nils Thiele:
> >> Hey,
> >> we are currently still deploying java 7.
> >> i was looking into java 8 but it seems oracle removed the function to
> >> automaticly remove the installed version and replace it with the new
> >> one like in java 7, instead it will install the update additionally.
> >>
> >> The easiest solution is of course to keep the previous versionnumber
> >> in the package and remove it before the installation of the new one.
> >> But this wont work if a system doesnt have the last release but maybe
> >> a older one because it hasnt connected to the server that often.
> >>
> >> Now i was wondering if it is possible to use regex to fix this
> >> problem inside the package file without having to rely on other problems.
> >>
> >> If you use regex command like this
> >> Java.8.Update.([0-9]*)
> >> the result of regex is the sub version number.
> >>
> >> Is it possible to integrate the results of a check into a wpkg
> >> variable?
> >>
> >> Something like this:
> >> <check type="uninstall" condition="exists" path="Java 8 Update
> >> ([0-9]*)" /> <variable name="oldsubversion"
> >> value="%regexcheckresult%" /> <upgrade cmd='msiexec.exe /qn /x
> >> {26A24AE4-039D-4CA4-87B4-2F832180%oldsubversion%F0}' />
> >>
> >> This obviously wont work, just wondering if something like this is
> >> possible at all without having to rely on a "outside" wpkg script.
> >>
> >> Thanks!
> >>
> >> Best regards,
> >> Nils
> >>
> >
> > The ability for in place updates is still listed in the documentation,
> > but it seems that the installer is broken.
> >
> > You can use the code below to remove any previous release of the
> > 32-bit JRE 8.
> >
> > Use "FOR /?" in a command prompt for further information about the /L
> > switch of the FOR DOS command.
> >
> > '---code start (watch for line wraps)
> >
> > <remove cmd="%ComSpec% /c for /L %N in (10,1,99) do msiexec /passive
> > /x {26A24AE4-039D-4CA4-87B4-2F832180%~NF0}">
> >     <exit code="1605" />
> > </remove>
> >
> > '---code end
> >
> > --
> > Stefan P.
> >
> > Top-posting:
> > A: Because it messes up the order in which people normally read text.
> > Q: Why is top-posting such a bad thing?
> > A: Top-posting.
> > Q: What is the most annoying thing in e-mail?
> >
> > ----------------------------------------------------------------------
> > --- SSLrack - get your cheap cheap SSL certificates (standard,
> > wildcard,
> > EV)
> > http://www.sslrack.com/
> > ----------------------------------------------------------------------
> > ---
> > wpkg-users mailing list archives >>
> > http://lists.wpkg.org/pipermail/wpkg-users/
> > _______________________________________________
> > wpkg-users mailing list
> > wpkg-users at lists.wpkg.org
> > https://lists.wpkg.org/mailman/listinfo/wpkg-users
> 
> Hey just to keep other updated...
> I tried the method (replaced /passive with /qn tho after testing was
> done) and i noticed something.
> With the Command you posted it always stopped after the the 26th attempt
> while using wpkg.js, running the command manually in cmd promt worked
> fine. (Win7 Prof x64) Adding ">NUL" to the command fixed the problem for
> me!
> 
> This is the code im using now:
> <remove cmd="%ComSpec% /c for /L %N in (10,1,99) do msiexec /qn /x
> {26A24AE4-039D-4CA4-87B4-2F832180%~NF0} >NUL">
>       <exit code="1605" />
> </remove>
> 
> Hope i could help someone else with this!
> 
> Nils

  I thought you might find some of this useful :-)

 http://www.oracle.com/technetwork/java/javase/8u20-relnotes-2257729.html
- Basically this outlines that from u20 onwards, JRE is installed to a folder that always includes the version but still supports static and patch-in-place installs (ie overwriting old versions). The patch-in-place (STATIC=0) might actually be happening but just not be very visible maybe?

 http://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_installer_options.html
- Which outlines options you can change when installing JRE (including the install directory if you prefer the JRE to install to a specific location). I'd recommend skipping trying to use the configuration file option and just using the options directly on the install command line because it's way simpler to see what you're doing )or add them as properties to a transform if you go to the lengths of extracting the MSI from the .exe installer)

 IIRC, Oracle ( originally Sun) had a convention for their MSI product IDs and rather than use random GUIDs, as they should,  they tinkered with them to make them a bit more programmatically accessible. they still seem to be sticking to it nicely. I've been hunting goggle for an article I read once but I couldn't find it tonight so this is a bit rough but, from memory, the ProductCode GUID's are formatted as;

{26A24AE4-039D-4CA4-87B4-2F8[Two-digit bitness]1[1-digit major][1-digit minor][two-digit patch][two-digit product]}

 Where;
    bitness is;
         "32" or "64" accordingly
    major. minor and version are;
         the release version number (8u31 is properly versioned as 8.0.31 as the java team never release anything but major releases and patches, so the minor code is always 0)
    product is; (bearing in mind I'm trying to remember the details)
         "FF", "F0" - one is the static install, the other the patch-in-place install (but I can't remember which is which. Doh!)
         "FB" - is the J2SE version
         ...and I think there's also a code for the JDK version but I've not ever had a chance to install that to check :-)

 If you find yourself still with some stray sheep to deal with still, you can probably nest a few loops inside that loop to try and cover the bitness and variants  :-)

Regards,

Keith



> --
> IT-Support - Fachbereich 09 Kulturgeschichte und Kulturkunde Universität
> Hamburg
> 
> -------------------------------------------------------------------------
> SSLrack - get your cheap cheap SSL certificates (standard, wildcard, EV)
> http://www.sslrack.com/
> -------------------------------------------------------------------------
> wpkg-users mailing list archives >> http://lists.wpkg.org/pipermail/wpkg-
> users/
> _______________________________________________
> wpkg-users mailing list
> wpkg-users at lists.wpkg.org
> https://lists.wpkg.org/mailman/listinfo/wpkg-users
> 
> ___________________________________________________________
> This email has been scanned by MessageLabs' Email Security System on
> behalf of the University of Brighton.
> For more information see http://www.brighton.ac.uk/is/spam/
> ___________________________________________________________

___________________________________________________________
This email has been scanned by MessageLabs' Email Security
System on behalf of the University of Brighton.
For more information see http://www.brighton.ac.uk/is/spam/
___________________________________________________________


More information about the wpkg-users mailing list