[wpkg-users] [Bug 173] Allow the use of environment variables for checking file revisions
Pendl Stefan
stefan.pendl at haidlmair.at
Mon Sep 21 19:49:48 CEST 2009
> --- Comment #1 from Rainer Meier <r.meier at wpkg.org>
> 2009-09-21 19:34:55 ---
> Hi Stefan
>
> Sounds like a reasonable request. At the beginning I thought
> "yes, of course,
> let's quickly do it". Unfortunately it became a bit more
> complex. Especially
> this requires on every revision number query to set the full package
> environment and restore it after evaluating it.
> To prevent this for packages where it is not needed (I think
> using environment
> variables in revision strings will not become very popular)
> I've added a quick
> check and variables will be expanded only if at least two "%"
> characters are
> found.
>
Hi Rainer,
as an example, see Notepad++, which includes the version number in the installer file name.
This leads to changing the version number in up to four places, depending on your package definition.
I do not only check for the uninstall entry, but for the correct main executable version too.
I do support x86 and AMD64 platforms, so I need to change this in four places, twice for the file check and once each for the install and upgrade command.
So I can now use the following package definition:
>>
<package
id="NotepadPlusPlus"
name="Notepad++"
revision="5.5.0.0"
reboot="false"
priority="30">
<variable name="JH_NPP_VER" value="5.5" />
<check type="uninstall" condition="exists" path="Notepad++" />
<check type='logical' condition='or'>
<check type="file" condition="versiongreaterorequal" path="%ProgramFiles%\Notepad++\notepad++.exe" value="%JH_NPP_VER%" />
<check type="file" condition="versiongreaterorequal" path="%ProgramFiles(x86)%\Notepad++\notepad++.exe" value="%JH_NPP_VER%" />
</check>
<!-- remove plug-in's to prevent installer hanging -->
<install cmd='%ComSpec% /c if exist "%ProgramFiles%\Notepad++\plugins" del /f /q "%ProgramFiles%\Notepad++\plugins\*.dll"' />
<install cmd='%ComSpec% /c if exist "%ProgramFiles(x86)%\Notepad++\plugins" del /f /q "%ProgramFiles(x86)%\Notepad++\plugins\*.dll"' />
<install cmd="%SOFTWARE%\NT-Install\Notepad++\npp.%JH_NPP_VER%.Installer.exe /S" />
<!-- remove plug-in's to prevent installer hanging -->
<upgrade cmd='%ComSpec% /c if exist "%ProgramFiles%\Notepad++\plugins" del /f /q "%ProgramFiles%\Notepad++\plugins\*.dll"' />
<upgrade cmd='%ComSpec% /c if exist "%ProgramFiles(x86)%\Notepad++\plugins" del /f /q "%ProgramFiles(x86)%\Notepad++\plugins\*.dll"' />
<upgrade cmd="%SOFTWARE%\NT-Install\Notepad++\npp.%JH_NPP_VER%.Installer.exe /S" />
<!-- Windows 32-bit -->
<remove cmd='%ComSpec% /c if exist "%ProgramFiles%\Notepad++\plugins" del /f /q "%ProgramFiles%\Notepad++\plugins\*.dll"' />
<remove cmd='%ComSpec% /c if exist "%ProgramFiles%\Notepad++\uninstall.exe" "%ProgramFiles%\Notepad++\uninstall.exe" /S' />
<!-- Windows 64-bit -->
<remove cmd='%ComSpec% /c if exist "%ProgramFiles(x86)%\Notepad++\plugins" del /f /q "%ProgramFiles(x86)%\Notepad++\plugins\*.dll"' />
<remove cmd='%ComSpec% /c if exist "%ProgramFiles(x86)%\Notepad++\uninstall.exe" "%ProgramFiles(x86)%\Notepad++\uninstall.exe" /S' />
</package><<
Thanks for the additional check, if expansion is needed,
Stefan
More information about the wpkg-users
mailing list