[wpkg-users] help: install if file does not exist

Jacob Jarick Jacob.Jarick at amdel.com
Thu Sep 17 12:40:34 CEST 2009


Thanks for the info Rainer, I will shift to your suggestions instead of my rename.
Was my check syntax correct though ?


-----Original Message-----
From: Rainer Meier [mailto:r.meier at wpkg.org]
Sent: Thu 17/09/2009 5:55 PM
To: Jacob Jarick
Cc: wpkg-users at lists.wpkg.org
Subject: Re: [wpkg-users] help: install if file does not exist
 
Hi Jacob,


Jacob Jarick wrote:
> I am trying to make a package install on the condition a file exists.
> 
> here is my current package:
> 
> <package
> 	id="JavaUpdate" 
> 	name="Disable Java Update" 
> 	revision="1" 
> 	reboot="false" 
> 	priority="10">
> 
> 	<check type="logical" condition="not">
> 		<check type="file" condition="exists" path="%PROGRAMFILES%\Java\jre6\bin\jusched.exe" /> 
> 	</check>
> 	<install cmd='cmd /c ren "%PROGRAMFILES%\Java\jre6\bin\jusched.exe" jusched.exe.disable ' />
> </package>
> 
> unfortunately it returns true, even though the file exists. I have tested the "install cmd" via console and the cmd does work.


First of all I don't believe that renaming the exe file is the right way. In
fact it could even cause problems.
Instead I recommend just to remove the startup entry for the update sheduler:

reg delete "RUN_PATH=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /v
"SunJavaUpdateSched" /f

This removes the startup of the update scheduler.
On this occasion you might also disable the quick starter service:

net stop JavaQuickStarterService
sc config JavaQuickStarterService start= disabled

This approach works for me since quite a while.


Your rename might fail for example if jusched.exe is still running while you try
to rename it. So you should at least use taskkill to assure that it's not running.

br,
Rainer




More information about the wpkg-users mailing list