Skip to content
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

Automatically install updates on Mac #414

Open
teocomi opened this issue Jan 28, 2023 · 6 comments
Open

Automatically install updates on Mac #414

teocomi opened this issue Jan 28, 2023 · 6 comments

Comments

@teocomi
Copy link

teocomi commented Jan 28, 2023

We've been successfully using NetSparkle for a while now; thanks for it!
On Windows, we can get updates to be automatically installed without any user interaction (using exe); on Mac instead the new dmg is downloaded and launched automatically, but the user still has to:

  • override the previous app
  • re-launch the app
  • close the dmg folder

Some users have reported this being a bit annoying, is there any way to automate these steps?

@Deadpikle
Copy link
Collaborator

Hi @teocomi,

Sorry for not replying to your message yet. I apologize. Life is extremely busy right now and I am struggling to keep up, plus I am on a 3-week trip starting Wednesday! (I think one of your team members also pinged me on Twitter once and I never replied. Oops. Apologies.)

Short version: This should be doable in one way or another. Sparkle does this and utilizing their AutoUpdate.app in some way is not entirely out of the question, although I'm not sure how I feel about downloading an external application just to update an app.

A very very basic way would be to just arbitrarily copy the .app in the .dmg to /Applications (see basic support here) in the shell script that opens the DMG. Or, you could package your app as a .zip and simply extract over your current .app file (which is sort of already supported).

But neither of those really think about or consider sandboxing, which I have no clue how to handle without more research.

@teocomi
Copy link
Author

teocomi commented Feb 7, 2023

Thanks for your reply during such busy times; we know what it feels like :)
We'll give it a try and report back!

@Deadpikle
Copy link
Collaborator

@teocomi,

I had a few minutes to try things out. I wanted to try without any extra downloads. See branch feature/macos-dmg-auto-install-restart. It successfully mounts the DMG, extracts the .app file, and unmounts the DMG. However, the final open SimpleApp.app line (to actually restart the software) fails with the obscure error No application knows how to open URL SimpleApp.app. Don't know what's going on there yet. But there's a branch you can test around with — specifically the NetSparkle.Samples.Avalonia.MacOS sample in that branch.

@teocomi
Copy link
Author

teocomi commented Mar 13, 2023

Hey @Deadpikle, thanks so much for this!!

I tried it and have some comments:

  • I think the command to launch the app should be open -a ""{executableName}"""; (with the -a flag)
  • When I try this locally I get a permission window briefly, and then it disappears, so I cannot fill in my password, is this expected?

Screenshot 2023-03-13 at 21 11 36

@Deadpikle
Copy link
Collaborator

@teocomi

I think the command to launch the app should be open -a ""{executableName}"""; (with the -a flag)

This fixed that problem. Nice! Thank you. I just got a full update and auto-restart to work.

When I try this locally I get a permission window briefly, and then it disappears, so I cannot fill in my password, is this expected?

🤔 It showing up is expected; I'm running the commands as sudo so it asks for an admin prompt. (I haven't yet tested without that but even Sparkle has that IIRC. Ideally, I'd love to make that say that "MyApp" is wanting to make changes or something...) I'm not sure why it's disappearing on your computer though...clearly needs some more debugging/fixing/work.

If you want to use the battle-tested Sparkle project on macOS, https://github.com/Deadpikle/macOS.SparkleUpdater.Avalonia might be helpful to you. Frankly, I'll be the first to admit that this project is not nearly as battle-hardened as the Sparkle project that has been in use for (I believe) well over a decade.

@teocomi
Copy link
Author

teocomi commented Mar 14, 2023

It seems like the osascript process is launched as a child of the Avalonia App one, so when it exits that is closed too.
I tried changing UseShellExecute = true but the same happens...
Is it because I'm debugging? I'm on an M1 Ventura 13.0.1 .

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants