[wpkg-users] help: install if file does not exist
Rainer Meier
r.meier at wpkg.org
Thu Sep 17 11:55:02 CEST 2009
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