Conditional component install
Posted 01 March 2007 - 23:06
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).
Posted 01 March 2007 - 23:33
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.
Posted 02 March 2007 - 21:26
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.
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);
HandleMoveDataError( nResult );
SprintfBox (INFORMATION, szTitle, "%s does not exist", svBlankIconTempDir);
Wonder how I use ComponentSetData, the same way?
Edited by Blackdog, 02 March 2007 - 22:00.
Posted 07 March 2007 - 21:49
>>> 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
ComponentSetData to disable the component (and not install it)
(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.
Posted 07 March 2007 - 22:00
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!