[wpkg-users] Issue in conditional check

Malte Hohmann DoNotSendToThisAddress at gmx.de
Thu Feb 16 11:36:33 CET 2012


Hi all,

I have come across an issue with the conditional execution of a command:

I have the following package where the installation works, but removal does not due to environment variables not expanded in the conditional check:

<package id="FP_NO_AUTOUPDATE" name="Disable Flash Player auto-update" revision="2" priority="-1" notify="false">
	<variable name="INST_PATH" value="%WINDIR%\system32\Macromed\Flash" />
	<variable name="INST_PATH" value="%WINDIR%\SysWOW64\Macromed\Flash" architecture="x64" />
	<variable name="INST_FILE" value="mms.cfg" />
	
	<check type="execute" path="%COMSPEC% /C find /I "AutoUpdateDisable=1" "%INST_PATH%\%INST_FILE%" 1>NUL 2>&1" condition="exitcodeequalto" value="0" />
	
	<commands>
		<command type="install" timeout="5" cmd="%COMSPEC% /C echo AutoUpdateDisable=1 1>"%INST_PATH%\%INST_FILE%"" />
		
		<command type="upgrade" include="install" />
		
		<command type="remove" cmd="%COMSPEC% /c del /s /q "%INST_PATH%\%INST_FILE%"">
			<condition>
				<check type="file" path="%INST_PATH%\%INST_FILE%" condition="exists" />
			</condition>
		</command>
	</commands>
</package>

Looking into the wpkg logfile, the message "The path '%INST_PATH%\%INST_FILE%' does not exist: the test failed." appears.

For testing purpose I have changed the check's path to "%WINDIR%\mms.cfg". I know that this file does not exist, I just wanted to check if WPKG logs the expanded path or not. After running the removal with the changed path again, WPKG logs the following message: "The Path 'C:\WINDOWS\mms.cfg" does not exist [...]", so there seems to be an issue with the expansion of environment variables set during package execution.

I can work around this issue be simply setting the expanded path manually in the package, but for future versions of WPKG this should be corrected.

Regards



More information about the wpkg-users mailing list