[wpkg-users] Installing an icon when a file exists
Falko Trojahn
nospam_ft at smi-softmark.de
Mon Sep 7 10:03:11 CEST 2009
Hello Chris,
> I’ve got the copy icon part of this working but its the check I’m
> stuck on.
>
> I want to run the install/upgrade IF the application file exists to
> copy the icon on and run the uninstall if the application file doesn’t
> exist. Normal checks run the code the other way round, if the check
> “doesn’t exist”.
>
...
>
> However its not working.
>
> It doesn’t appear in the eventvwr logs.
>
> Each of the copy commands works when run at the command line so I
> think the problem lies in the logic
>
> Any ideas how I can achieve this?
>
IMHO you have two possibilities:
a) 2 packages dependent from each other, the first checks the existence
of the Application, the second checks existence of the icons
b) you use the check:
<check type="logical" condition="or">
<check type="file" condition="exists"
path="%SystemDrive%\netinst\sims-installed.txt" />
<check type="file" condition="exists"
path="%SystemDrive%\netinst\sims-not-installed.txt" />
</check>
and your copyicons.bat creates a file e.g.
echo ok >%SystemDrive%\netinst\sims-installed.txt
or
echo ok >%SystemDrive%\netinst\sims-not-installed.txt
(of course the c:\netinst\ dir must exist, but anyway you can use
every other dir you like;
you need the according remove commands
<remove cmd='cmd /c del /q
%SystemDrive%\netinst\logs\sims-installed.txt ' >
<exit code="any" />
</remove>
etc. )
I'd prefer the first way (a), so e.g. you have package one named "SIMS":
<package id="SIMS" ... />
<check type="file" condition="exists" path='"%programfiles%\SIMS\SIMS
.net\SIMSLoad.exe"' />
</package>
with NO install, upgrade or remove commands. Each time wpkg runs, it
checks for the file, so
the package is only marked as installed after manually installing your
application.
The second package could be like this:
<package id="SIMSicons" ... />
<check type="file" condition="exists"
path="%SYSTEMDRIVE%\ui\local\startmenu\staff\Programs\Administration\SIMS
Applications" />
<depends package-id="SIMS" />
<install cmd='%comspec% /c %software%\ui\copyicons.bat
"%ALLUSERSPROFILE%\Start Menu\Programs\SIMS Applications"
"startmenu\staff\Programs\Administration\SIMS Applications"' />
<upgrade cmd='%comspec% /c %software%\ui\copyicons.bat
"%ALLUSERSPROFILE%\Start Menu\Programs\SIMS Applications"
"startmenu\staff\Programs\Administration\SIMS Applications"' />
<remove cmd='%comspec% /c rd /s /q
"%SYSTEMDRIVE%\ui\local\startmenu\staff\Programs\Administration\SIMS
Applications"' />
</package>
Wpkg only tries to install this packages, if the dependency is met,
which means "SIMS" package's check is true - "SIMS" is installed.
So, when manually removing the application, the dependency is not met
any more and both packages including the icons will be removed.
We use this e.g. to check for different Office versions (Frontpage, SBS
etc.), so we have a dependency for the Office patches.
Best regards,
Falko
More information about the wpkg-users
mailing list