Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Conditional component install


4 replies to this topic

Blackdog

Blackdog
  • Full Members
  • 64 posts

Posted 01 March 2007 - 23:06

I have a IS6.3 project. I have a program that gets installed only if the user has a specific folder (not every install will get this file). I can not make it a part of ComponentSetTarget because everyone will not have this folder.

I am building a self extracting setup, run from web site or from CD.

Our previous install projects were always shipped on CD. I could put the file in a known directory and copy it if I found the specific folder. But how can I do this with a self extracting setup (not on a CD)?

I know of no variable to use when using ComponentSetTarget so that it can be extracted and also not extracted. I can not offer my users an install choice using options (won't understand which one to choose - generating a phone call).

Any advice?

johdaxx

johdaxx
  • Full Members
  • 6 posts

Posted 01 March 2007 - 23:33

You can use something like

ComponentSetData ( MEDIA , "My Feature" , COMPONENT_FIELD_SELECTED , FALSE , "" );

which would turn it off or on as necessary in your script. You can then use ComponentSetTarget to change it to the appropriate target as necessary.

Alternatively, you could theoretically install the files necessary to SUPPORTDIR and conditionally copy them from there, but I'd just use the Component properties instead.

-A-

Blackdog

Blackdog
  • Full Members
  • 64 posts

Posted 02 March 2007 - 21:26

Thanks, I'll look into this. Never knew (or had to use) the FALSE parameter before so it is new to me.

Checked my script and I only use ComponentSetTarget. I assign the object to a spcific folder and if the folder exists, I do the ComponentSetTarget and then move the data.

Example :
if (ExistsDir (svBlankIconTempDir) = EXISTS) then
nResult = ComponentSetTarget (MEDIA, "<svBlankIconDir>", svBlankIconTempDir);
if nResult < 0 then
ComponentError(svComponentSource, svComponent, svFileGroup, svFile, nvError);
SprintfBox(INFORMATION, "Set Blank\\Icon-Path Information",
"Set Blank\\Icon-Path had the following error:\n\n" +
"Media Name: %s\nComponent: %s\nFile Group: %s\n" +
"File: %s\nError Number: %ld",
svComponentSource, svComponent, svFileGroup, svFile, nvError);
return nResult;
endif;
HandleMoveDataError( nResult );
else
SprintfBox (INFORMATION, szTitle, "%s does not exist", svBlankIconTempDir);
abort;
endif;

Wonder how I use ComponentSetData, the same way?

Edited by Blackdog, 02 March 2007 - 22:00.


johdaxx

johdaxx
  • Full Members
  • 6 posts

Posted 07 March 2007 - 21:49

Let me see if I understand the concept here --

>>> I could put the file in a known directory and copy it if I found the specific folder. But how can I do this with a self extracting setup (not on a CD)?

>>> I know of no variable to use when using ComponentSetTarget so that it can be extracted and also not extracted.

So if I can restate the problem, you have a file that you want to install in some conditions, and not install in other conditions, right?

The way I've handled this situation in the past was to put the files in my media library with all the other files to be installed, but in their own component. Then, when the condition was evaluated, enable or disable the entire component, so it would get installed based on that condition. Loosely:

if <install condition> = TRUE
ComponentSetData to enable the component
ComponentSetTarget to point where it should go
else
ComponentSetData to disable the component (and not install it)
endif;
(whatever else necessary)
(then move data)

That way you don't have to have the hassle of tracking anything else in a separate subdirectory, and you can control what conditions the files in the component are installed.

Blackdog

Blackdog
  • Full Members
  • 64 posts

Posted 07 March 2007 - 22:00

I think you understand what I am trying to do all right.

If a specific directory exists, I know I need to extract a program to go into that folder. If the folder does not exist, I should not extract it.

I think your example will help me. I just never used that command before and I use only ComponentSetTarget and then MoveData because I always put files in known directories. This situation, this folder may or may not be there.

In the past I simply included the program in the build, extracted to my own 'temp' directory. So I extracted all components. Then I determined if the folder exists, copy it into the specific folder and delete the 'temp' folder. If the folder does not exist I delete the 'temp' folder, extracting it for nothing basically.

My method involves more jacking around I know, so I was looking for an easier way. I think you guys have it for me. Thanks a lot!