Is it possible to control which files to install from command line for INNO installer? - inno-setup

I would like to control a subset of files and only allow some of them to be installed if run with a command line switch for instance.
Is this possible?
For example
if (some condition)
install full set of files
else
Install other set of files
Alternatively I can just run another installer but then I have to pass the file/path location to that second installer. There is also the issue of bundling that second installer with the first one. I think that part is not that difficult though

Yes, it is even rather easy. There are several ways to do this, all of which depend on Pascal scripting.
Method 1
You can use the GetCmdTail, ParamCount, and ParamStr functions to obtain the entire or parts of the command-line.
Then you can use the Check parameter on separate files. Hence, each file will be installed if and only if the called function returns true.

Related

I need different InstallShield prerequsite command lines for the same prerequisite

I have a batch file that builds 2 install projects. They each have SQL Server 2012 as a prerequisite but with different command lines (one is silent, one not for example). Anyway, I would like the projects to be built automatically without having to run one, manually change the prerequisite command line, and then run the other. As it is, there only seems to be one copy of the prerequisite settings - any ideas as to how to accomplish this? Thanks!
I can see two options. Neither are perfect, but I think I prefer the first.
Create two copies of the .prq, one with each setting. The quirk here is they either have to have different names (possibly good, possibly bad), or they have to be in different paths that you control, for example, with the -prqpath parameter to iscmdbld. While the different names makes it easier for you to verify which prerequisite each build has, it may be more confusing for someone installing the prerequisite.
Install the prerequisite as a feature prerequisite, allowing you to use [PropertyReference] notation in the prerequisite's command line. Then set the referenced properties up differently in the builds that consume them, perhaps with the -z parameter to iscmdbld.
Note that if the prerequisite you are modifying has a download URL for an updated prerequisite, your changes will be lost when it downloads InstallShield's version, so in a situation like this you are encouraged to modify it to point to one that you host.

When using cx_freeze, what files have to be updated to update the application?

I want to implement an autoupdater in my Python application. This is no problem with the source version; Python doesn't care at all that the script it's running is trying to overwrite itself.
Windows, however, does care if an EXE tries to overwrite itself. My question is, does my EXE even have to overwrite itself? Or is the EXE just an interpreter, and I only have to overwrite library.zip?
If it does, is there any alternative to starting an updater application and shutting down the main EXE?
The cx_Freeze exe is compiled along with cx_Freeze, so in most cases you can safely leave it alone and just update library.zip. However, you should make sure that you prepare your updates using the same version of cx_Freeze that you froze the application with originally, in case it expects specific things about the files around it.
Also, the exe gets stamped with a version number relating to your application (you can see it in the file properties). If you don't replace it, that version number won't change.
If you do need to replace the exe, I believe the trick is to copy it to a temporary folder and re-run from there, so that it can replace the original. You can also look into update frameworks like Esky, which aim to handle these kinds of details for you. I haven't used that, so I don't know how well it works.

Default Values to Inno Setup install

I have a group at work asking if there is a way to pass in values, either via command line or an ini value, that will "fill in" values that are normally provided by the user during install. For example, if I have a drop down that the user can select they're installing the client, server, or both, they want a way to automate this so the user doesn't have to select anything.
Basically, they want to automate running the installer without actually showing the wizard panels and populating user values based on command line args or an ini file.
I know you can use ini files, but I don't think they're used for this reason. And I don't see any way that command args would be used.
Is there a way native to Inno Setup to do this?
Thanks!
One way to set all the standard settings at once is to use an INF file via the /LOADINF parameter.
It is also possible to extend this to custom page settings if you wish (with cooperation by the setup author).
There are many command line parameters already included in Inno which you can use: http://www.jrsoftware.org/ishelp/index.php?topic=setupcmdline
With them you can set task, directory, group, components, password etc etc.
If you need something special you can use your own command line parameters.
Use GetCmdTail() function to get cmd line parameters for setup or uninstaller.
As this is common question there are already some advanced parsers and methods like this one:
Is it possible to accept custom command line parameters with Inno Setup
I suggest you to use /SILENT parameter for not showing the setup forms together with e.g. /TASKS, /DIR and /COMPONENTS and some custom parameter.

File script searching for versioning

I need to search through all sub directories of a directory and find all files containing a "VERSION" string including a number.
I need to increment this number, so 1.1.2 will be incremented to 1.1.3 etc. and save it in the file again.
I need to run this on Windows machines only, if it makes any difference.
Can I do this with cmd commands or do I need to use a program for this ?
I would like to run this without installing anything if possible.
I ended up writing a Java program to go through the entire structure.
I found that using CMD commands was too complicated for me to structure, and using a Java program I could also easily reuse parts of the program in different but similar structures elsewhere in my file system.
The CMD usage could my the files for me, but extract a single line, manipulating it and putting it back inside the file was not easy using CMD commands, where as using Java was much easier.

How to run an ant script from VC++

Assume a Visual C++ solution that outputs several executables. These executables are meant to be run in a certain order and with certain parameters -- and for this purpose there already is an ant build.xml script.
What would be a decent approach to integrating this ant script with VC++, such that the ant script will point against the recently output executables (.\Debug and .\Release folders) and ideally could be run directly from VC++, and dare I say with remote debugging.
I was thinking of using build post-events that populate a build.properties file with the output location of each executable, and let the ant script use this .properties file.
Any help on the matter would be great.
I'm not sure if there is a good answer for this. Perhaps you are not asking the right questions. From C++ you can launch anything, including scripts. I'm not sure what you mean by VC++ integration.
The generic answer would be:
save the output locations somewhere, doesn't matter where (file, registry, environment variables etc.)
retrieve them in the script before use
But depending on what you need, you could also try:
Output the same executables in the same folder structure. This way you can use relative paths.
Use a post-build event which copies the script in the output folder and make it use the relative path.
Instead of a script you can also try handling everything from the first EXE. Instead of an ANT script it could use a configuration file which specifies execution order and parameters.

Resources