Reputation: 1076
I am using Inno Setup for our WinDRBD driver, which is a port of Linbit's DRBD driver from Linux to Windows (https://github.com/LINBIT/windrbd). We are using Inno-setup for install/uninstall and it works very well.
One thing I noticed is that if the user installs the same version twice (or upgrades to a newer version, the script in the UninstallRun
section is run multiple times (once for each install) later when the user chooses to uninstall the program. Is there a way to make it only once, even if the user installed several upgrades?
What I am currently using is:
[UninstallRun]
Filename: "C:\Windows\sysnative\cmd.exe"; Parameters: "/c uninstall-windrbd.cmd"; \
WorkingDir: "{app}"; Flags: runascurrentuser waituntilterminated shellexec
(note: the sysnative
thing is because Inno Setup is 32-bit but the application is 64 bit, else INF install inside the script would do the wrong thing).
It is just a minor thing, we're running an INF file uninstall which displays a message box when run the 2nd+ time. Maybe I am missing some flag?
Upvotes: 2
Views: 3684
Reputation: 1076
Adding RunOnceId: "Uninstall"
(where "Uninstall"
is just a random tag, you can also use foobar
) to the uninstall line does the trick.
So,
[UninstallRun]
Filename: "MyUninstallProgram.exe"; \
Flags: runascurrentuser waituntilterminated runhidden; \
RunOnceId: "Uninstall"
would be a way to have an uninstall program run only once, even if there are upgrades installed.
Upvotes: 4