(NOTE: Added 'important edit' below to basically re-ask this question in a different way)

I know there are many different packages out there to put inside a delphi application for software intallation. I don't need anything fancy, I just need the ability to do some of the basic installation routines, such as proper installation/replacement of DLL's. I can do the majority of the installation manually, like copying files, saving registry settings, etc. I just need whatever it takes to make my installer properly register the new software with Windows (or updated software).

It would also be helpful if it can, for example, check if a file is currently being used before trying to replace it. Nothing visual is needed, there must be some sort of simple non-visual component which can handle these common routines. And it should also be free open-source, if possible. I don't want to have to distribute a load of DLL's or other third-party files with my installer.

Any good suggestions? Please don't answer with any huge complex fancy installer system. It just needs to be something simple to use directly in Delphi. It doesn't even have to be a component, even just a unit or library of units with some functions or such to help automate these common bits and pieces of installation.

ADDED NOTE: I already have an installer program made in delphi-7, but would like something I can throw in my project which includes any type of assistance with the most common parts of installing software.

IMPORTANT EDIT:

My approach in asking this question I believe is wrong. Please allow me to re-elaborate on this...

Our company already has a simple updater utility. Actually, this is not an 'Installer', but an 'Updater' program. it simply replaces a few EXE files, executes SQL statements (MSSQL server), writes some registry entries, etc...

These are the issues I face with how this program is currently working:

Upon attempting to replace a DLL, the DLL might be in use, and therefore 90% of the time fails to replace the DLL. I need something that can check if the DLL is in use and (if possible) either forcefully replace the DLL anyway, or tell Windows to replace the DLL on the next restart.

The EXE name is 'Setup.exe' which Windows 7 automatically recognizes it as an installer (and thinks that it failed to install). I know there are workarounds for this, in fact, I saw a question here at stackoverflow recently for this exact case. I'd like to see if there's already something ready with whatever it is I get which can take care of this, instead of me doing the work manually.

This is a server/client system I'm working with. IF the installation is on the server, it also needs to update (replace) the service EXE. I know how to start/stop services, but have a lot of difficulties in waiting for the service to stop, then replace the file, then start it again. I'd like to see if this can be automated.

Executing a large SQL script (I mean over 25,000 lines in this script) is hell, and doesn't work half the time. It includes many instances of 'GO' which cannot be recognized by standard components, such as ADO. I can use a batch file to execute this, but that's getting a little dirtier than I'm comfortable with. There must be a way to execute such a script without the use of batch files - especially reading the result and trying to identify if there were any errors in the update.

This updater is also going to install another third-party installation, specifically SQL Native Client Drivers. I'd like something that is already ready to launch another installer and wait for the result of it (success or failure). If it fails, I need to know to continue the updater differently.

I can understand how it's difficult to understand what I'm asking for. I don't need a solution that can be used for anything and everything thrown at it. This is for this one software, nothing else. I know there probably isn't one single solution to cover all of the above, but any help would be great.

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

You're asking for a lot of functionality in a component (and doing a lot of work yourself by doing "the majority of the installation manually"). I'm posting an answer that isn't a component; if it won't work for you, downvote it. :)
–
Ken WhiteDec 1 '11 at 3:37

2

The functionality you're looking for is more than a "simple component". Updates, registering with Windows, delayed update of files in use, etc. InnoSetup (as mentioned in my answer) makes a single executable (no external DLLs, single file distribution, handles all your requirements and more, and comes with full Delphi source, and fully debugged and tested by hundreds of thousands of users of Delphi and non-Delphi development environments) seems like a no-brainer. I'm not sure what your actual project (or job) entails, but you apparently have a lot of extra "reinvent the wheel" time. :)
–
Ken WhiteDec 1 '11 at 3:53

2

Jerry, if you want a free and easy and working installer, use InnoSetup. It will do all your tasks. Alternative is to create a msi-file, but i can not recommend a tool for that. Generally, msi-files are much more complicated than InnoSetup.
–
AndreasDec 1 '11 at 7:05

1

This question is astoundingly broad and nebulous. You are asking too many questions all at one, and not giving enough specifics.
–
David HeffernanDec 1 '11 at 11:21

1

Voted to close because this is a wide range of discussion topics crammed into a small essay, not a question.
–
Warren PDec 1 '11 at 14:06

3 Answers
3

The JCL library includes a lot of the low level Windows functionality that you require. Most anything that can be done through the Windows API is available in JCL.

Refer to the previous question about what you need to do to prevent the "This program might not have installed correctly" message.

I scripted a similar database updater in the past that included many Go statements, for a MS SQL database. I used a VB script. That might not be a huge improvement over what you have now, but it did include flow control and trap errors. You can link to Windows Script Host in Delphi, but my main point is to figure out what interfaces are exposed by your DBMS and use them.

Here's a tip regarding DLLs. Don't put them in the Windows system folder. Put them in the same folder as the executable. This prevents other people from sharing your DLLs. That way, when your program is shut down, the DLLs are not loaded and you can replace them. If you're using shared system DLLs, then there's no workaround to rebooting.

If this updater is for the public, don't forget to sign it and put in the application manifest, so the users have a good experience.

I recommend tackling one issue at a time, and unless your application welcomes test units, write a small program to test each solution.

Thanks, this was the only comment here which was professionally answered and not sarcastic and rude.
–
Jerry DodgeDec 1 '11 at 14:39

2

@Jerry Have another read of the comments and answers. I don't see much evidence of sarcasm and rudeness. In fact I see a lot of people giving up their time and earnestly trying to help. The fact that people offer quite different views to your own does not equate to rudeness.
–
David HeffernanDec 1 '11 at 15:44

2

Now I feel bad because I also voted for the other "rude" answers. :)
–
Marcus AdamsDec 1 '11 at 15:49

@DavidHeffernan Oops, I used the wrong operator, or not and - indeed there's nothing rude about your answer, but 'your long list of questions' and 'why you are reluctant' stand out as sarcasm to me. There was a lot of confusion and aggervation on my side in asking the question, and I also voted to close. I really appreciate all the help, and I can't accept both answers, but I'm a strong believer in professionalism - this is a professional website, correct?
–
Jerry DodgeDec 1 '11 at 15:51

2

@Jerry I avoid using sarcasm here on Stack Overflow. My comments were critical of you but directly so rather than sarcastic. Questions work better if you contain their scope. In my view this question was too broad. Regarding the reluctant quote, again there's no sarcasm there. Just directness. I was trying to challenge you to think differently. That's all.
–
David HeffernanDec 1 '11 at 15:57

While it's not a component, I'm posting this anyway. (Trying to do the work of an installer manually when there are great alternatives is a waste of your time, IMO, but feel free to vote this answer down if you find it unacceptable.)

InnoSetup is very well done, and (bonus) is written in Delphi and has source available. It does everything you can wish for in an installer (except create .msi files, which some large network admins require - this won't affect you, since you're willing to write most of your installation code yourself).

You'll want to get the IsTool GUI interface (available from the downloads page), which makes it much easier to configure the install scripts.

That's the one I forgot the name of! I've heard that name mentioned a few times in the past and blew my mind what it was. I'll give it a go and see where I can get, thanks.
–
Jerry DodgeDec 1 '11 at 3:39

Just my 2 cents... One of our project installers does all the points in the OP edit - all with Inno. However we use Inno to call a small Delphi program to do the SQL updates as this is a lot easier to manage using Delphi. We do full installs or upgrade only from the same script; Run a custom helper DLL; Install Microsoft redistributables if required; Replace event manager resource DLLs; Stop/replace/restart a server service. Waiting for the service to stop and be released by Windows is a bit of an issue but it's doable. Inno is the kiddie for small and large installations!
–
shuntyDec 1 '11 at 8:43

2

@JerryDodge, if vanilla Inno Setup is too much (or too little) for you, write something that provides the exact amount of flexibility you need but make it so it generates an ISS script, not the actual installer. For the record I'm using Inno to install/upgrade Firebird SQL server. That includes figuring out if it's already installed, if it needs upgrading, stopping the service, running Firebird's installer, updating UDF DLL's, restarting the server.
–
Cosmin PrundDec 1 '11 at 10:57

2

InnoSetup is a fabulous UPDATER too, not just an installer. In fact, it's better suited for UPDATING than almost any other tool because it is stable, and functional, and small. That's what updaters should be.
–
Warren PDec 1 '11 at 14:07

Upon attempting to replace a DLL, the DLL might be in use, and therefore 90% of the time fails to replace the DLL. I need something that can check if the DLL is in use and (if possible) either forcefully replace the DLL anyway, or tell Windows to replace the DLL on the next restart.

The EXE name is 'Setup.exe' which Windows 7 automatically recognizes it as an installer (and thinks that it failed to install). I know there are workarounds for this, in fact, I saw a question here at stackoverflow recently for this exact case. I'd like to see if there's already something ready with whatever it is I get which can take care of this, instead of me doing the work manually.

This is a server/client system I'm working with. IF the installation is on the server, it also needs to update (replace) the service EXE. I know how to start/stop services, but have a lot of difficulties in waiting for the service to stop, then replace the file, then start it again. I'd like to see if this can be automated.

All the standard ways I know to stop a service wait until it has stopped running.

Executing a large SQL script (I mean over 25,000 lines in this script) is hell, and doesn't work half the time. It includes many instances of 'GO' which cannot be recognized by standard components, such as ADO. I can use a batch file to execute this, but that's getting a little dirtier than I'm comfortable with. There must be a way to execute such a script without the use of batch files - especially reading the result and trying to identify if there were any errors in the update.

This updater is also going to install another third-party installation, specifically SQL Native Client Drivers. I'd like something that is already ready to launch another installer and wait for the result of it (success or failure). If it fails, I need to know to continue the updater differently.

I regard these points as being too generic to give advice on.

All of these issues would be trivial with the help of a good third party install program like InnoSetup. I can't understand why you are reluctant to avail yourself of such a useful helping hand.

I have a lot of reasons not to resort to a new system, mainly because 1) we already have an updater, it just needs additions, 2) It is not up to me, it's up to my boss and user community, and 3) the existing update utility has a whole lot of other existing functionality which I am not going to explain for confidential reasons.
–
Jerry DodgeDec 1 '11 at 15:31

@Jerry It's very possible to invoke your existing code from Inno or a similar tool. It doesn't have to be one way or the other, there are good hybrid solutions. Anyway, I think you've heard the message by now! ;-) I hope I have answered some of your questions with the above.
–
David HeffernanDec 1 '11 at 15:40

2

@Jerry: Did you ever asked yourself why even big software companies chhose commercial installer insted of writing their own? Creating a good installer is complex and require a good knowledge of the installation process. Good installer are able to "rollback" changes if something goes wrong and leave the system as clean as possible. You're reinventing the wheel and while "testing" your installer on real system you just risk to damage them. Your lack of knowledge about how some operations should be performed tells that it would be better to avoid the DIY approach. But you won't change your mind.
–
Mad HatterDec 1 '11 at 15:46