1
votes

I will install our software from a client machine, and I want to run a procedure CreateServiceCMD which stops/starts three services on the file server. Therefore on the file server runs a fourth service, which will wait for a CMD-File. The advantage is: No Administrator privileges are needed for the installation!

You have to know how it works (should work):

  • start setup from client machine
  • after selecting the paths, the procedure CreateServiceCMD(stop) will create the CMD file on the server, and my special service will stop the three other services
  • installing the files on the server
  • starting the application once with the parameter "UpdateAutoClose" (see below), so the application will be started, the database will be updated, the application closes automatically, and everything is ok, and setup is finished
  • but before finishing I have to call the procedure CreateServiceCMD(start) that my special service on the server starts the other three services again.

I tried everything but I can't find the right position for the CreateServiceCMD(start). AfterInstall, PostInstall, wpFinished, DeInitializeSetup() and I tried it for hours...

[Run]

Filename: "{code:GetInstallDir|Program}\{#AppStartName}"; Parameters: "-UpdateAutoClose"; \
  Flags: postinstall skipifsilent; \
  Description: "{cm:LaunchProgram, {#AppName} {#AppVerTxt} Datenbank Update}"

The problem is, I have to wait till the application has closed again and then run my procedure, but I can't find the right place. Everything I tried is much too early.

Hope someone can help...?

1

1 Answers

1
votes

I believe you are looking for the CurStepChanged:

procedure CurStepChanged(CurStep: TSetupStep);
begin
  if CurStep = ssInstall then
  begin
    { installation is starting }
    CreateServiceCMD(stop);
  end
    else
  if CurStep = ssPostInstall then
  begin
    { installation has finished }
    CreateServiceCMD(start);
  end;
end;