clowd / Clowd.Squirrel

Quick and easy installer and automatic updates for cross-platform dotnet applications
427 stars 39 forks source link

Run after install #190

Closed thumDer closed 10 months ago

thumDer commented 10 months ago

Is there any way to disable automatic run after the install is completed? I know silent mode more or less does this, but I would like to hardcode this behaviour in the installer itself.

caesay commented 10 months ago

It's not currently possible. What's your use case?

My first impressions are, if you control the installation environment, you can use silent mode anyway. If you don't control the installation environment (eg. external users) then it shouldn't be silent by default.

thumDer commented 10 months ago

It's a custom tool for external users, that is mainly a cli, but has a UI as a fallback. Now, the UI always shows up after installation. which is not critical, just wanted to know if it is avoidable. Thanks for the reply, though.

caesay commented 10 months ago

If this application is something that you control, you could also handle the first run hook, which Squirrel adds the very first time your app is run. If it's the first run, you can just exit silently.

thumDer commented 10 months ago

Okay, so you are saying, that the first run is always the one right after installation? If it is installed silently, than there is actually no "first run"? If so, we can use this, thanks!

caesay commented 10 months ago

Assuming you have hooks enabled, your app will get run with certain command line arguments. SquirrelAwareApp.HandleEvents() handles these for you.

The onEveryRun hook contains a property for if this is the first run after install.

Something like SquirrelAwareApp.HandleEvents(onEveryRun: (version, tools, firstRun) => { if(firstRun) Environment.Exit(); }));

If you are not using the SquirrelAwareApp helper, then you need to handle all the squirrel arguments, like --squirrel-install and --squirrel-firstrun for example and implement the logic yourself. https://github.com/clowd/Clowd.Squirrel/blob/master/src/Squirrel/SquirrelAwareApp.cs