Reputation: 95
I've got a task to sort out a problem with our product installer and eventually came to a dead end with no ideas.
The installation process goes like:
[Run]
section So the issue was something Shroedinger's - on SOME machines there were unexpected reboot after cancelling install in configurator, without any questions. Of course that annoyed users.
I couldn't figure out the criteria by which the machine decided to reboot, but I stumbled onto this thing:
In [Run]
section
Filename: "stub.exe"; Flags: runhidden skipifdoesntexist; BeforeInstall: ConfigureService
Then in [Code]
, ConfigureService
calls for InstallationAbort
proc if configurator returned bad exit code.
Next, in InstallationAbort
:
Exec(ExpandConstant('{uninstallexe}'), '/VERYSILENT /noinstancecheck', '', SW_HIDE,
ewWaitUntilTerminated, ErrorCode);
So the author calls for uninstaller WHILE IN THE INSTALLER. Using logs I determined, that installation program doesn't end after uninstaller completes work! It's moving to the next step (installation finished)! After that I can see in log
Restart needed? Yes
Note: system never reboots if configurator is not cancelled, i.e installation finishes the right way.
So what I tried:
/NORESTART
to uninstaller Exec
call. Doesn't help. I think that's because it's installer, who decides to make a restart.WizardForm.CancelButton.OnClick(WizardForm.CancelButton);
and some other calls to exit setup after call to uninstaller. Doesn't help.NeedRestart
function to return false in case of cancellationAs I tried to understand, author calls uninstaller because of need to delete installed services (i.e. call them in UninstallRun
with special parameters)
So, my main question: Is that a normal practice to call uninstaller from code called from [Run]
section, to undo changes made in [Run]
?
Upvotes: 1
Views: 914
Reputation: 202682
Is that a normal practice to call uninstaller from code called from
[Run]
section, to undo changes made in[Run]
?
In general, it's not a common practice. One should not abort installation in Run
section. Inno Setup is not designed to handle that.
But if you need to, there's no other way. The code you have is most probably based on this:
How to force Inno Setup setup to fail when Run command fails?
But that does not imply that the installer should require reboot. There's some conflict between the installer and uninstaller.
Upvotes: 1