Investigate better ways to run the updater script as `sudo` on macOS if needed
#253 opened on Nov 21, 2021
Repository metrics
- Stars
- (822 stars)
- PR merge metrics
- (PR metrics pending)
Description
Running things as sudo is just a mess if you don't have a terminal 😅 We can use osascript to run a shell script with admin privileges, but it's kind of clunky, as the sudo prompt says osascript rather than your bundle or app name, which might be suspicious to users. See the macOS Avalonia sample for this here: https://github.com/NetSparkleUpdater/NetSparkle/tree/develop/src/NetSparkle.Samples.Avalonia.MacOS.
I really want to avoid forcing the end user to ship more (native/other) binaries with their application or force users to have a .app for their application (which I think is what Sparkle assumes?), but in order to get all the features we want and actually make things work well, we may not be able to avoid it...
Some links to think about:
- https://stackoverflow.com/questions/2246421/run-a-bash-script-as-root-with-objective-c-cocoa
- https://github.com/performantdesign/cocoasudo
- https://developer.apple.com/documentation/security/authorization_services?language=objc
- https://stackoverflow.com/questions/10283062/getting-sudo-to-ask-for-password-via-the-gui
- https://stackoverflow.com/questions/1517183/is-there-any-graphical-sudo-for-mac-os-x
- https://apple.stackexchange.com/questions/23494/what-option-should-i-give-the-sudo-command-to-have-the-password-asked-through-a