-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for (un)install hooks #11
Conversation
Hi! awesome thanks! LGTM. I ll check this and load that. TBD:
|
No problem, I may also tackle #9 if I find the time tomorrow.
Out of curiosity, what's there to check? |
a7b638b
to
e71bba8
Compare
I have updated the PR so that hooks are run with elevated privileges. |
Actually, it doesn't need any magic, windows runs the bat files directly due to the special meaning it gives to extensions. |
I have made one last change to make sure uninstall hooks run before files are removed |
2948d0c
to
8646be6
Compare
8646be6
to
31015db
Compare
Hi, I merged and tried to validate your changes, but for me it won t work. See the testing here https://github.com/mh-cbon/go-msi/blob/master/testing/hello/wix.json#L40 When i msi install, it triggers an error code 1603, it also indicates a windows event ID 11708. I also tried to change the command to something like I m not sure what s wrong here, i have not tried to dig the wix documentation. |
Interesting, it works for me without problems.
Can you get the full logs of the installation?
|
Oh, is Did you try it in the command line? The hooks check the status code of the command so, if the command fails, the installer will fail. Also |
hi, great! It works now : ) Though i think i ran into one problem which is not handled, As a result for the end user, Is it possible to ensure the configuration |
Another problem i run into is about uninstall. The msi installed with success, But, on uninstall, via It will work only if the user chooses to ignore I m not sure if it is something the hooks |
Finally, i got it working! When uninstalling the program via The reason is about the uninstall For some reasons, it returns errors such as I finally simply removed it, |
The problem in the case is that the hooks are not robust enough. I ended up using a batch file which takes care of all these situations and rollbacks all actions if anything fails.
This PR only implements hooks as a general mechanism. Using them for services is kinda hackish for the reasons above. It would still make sense to implement #9 |
As a follow-up, it may be worth providing more granularity in the hooks. Now we only have We could potentially add all {pre,post}-install and {pre,post}-uninstall |
On top of that, we could tell the installer to use in-memory batch files (now you need to copy them with your installation files). I think there's a tag for that in wix. |
Can you expansively describe how that would look like and the possibilities ?
|
Fixes #2
This PR allows users to add (un)install hooks like the following in their
wix.json
file:(which, BTW, is a workaround for #9 until services are supported directly)
It doesn't (yet) provide any magic for executing batch files directly (i.e. the user needs to invokecmd.exe
) but it should be easy to extend the code creatingCookedCommand
.