Add interactive option to sparkle-cli

This allows installation by requesting the user to enter a password when elevated privileges are necessary. This only works if the application is alive before installation begins.
This commit is contained in:
Zorg committed 2016-05-28 23:04:43 -04:00
1 parent ec0889ef83
commit a113ce49bd
3 files changed
+19 -8

No files matched your search

+7 -2
View File
@@ -16,6 +16,7 @@
@property (nonatomic, readonly) NSString *applicationBundlePath;
@property (nonatomic, readonly) BOOL verbose;
@property (nonatomic) BOOL probingForUpdates;
@property (nonatomic, readonly) BOOL interactive;
@end
@@ -25,8 +26,9 @@
@synthesize applicationBundlePath = _applicationBundlePath;
@synthesize verbose = _verbose;
@synthesize probingForUpdates = _probingForUpdates;
@synthesize interactive = _interactive;
- (instancetype)initWithUpdateBundlePath:(NSString *)updateBundlePath applicationBundlePath:(nullable NSString *)applicationBundlePath updatePermission:(nullable SUUpdatePermission *)updatePermission deferInstallation:(BOOL)deferInstallation verbose:(BOOL)verbose
- (instancetype)initWithUpdateBundlePath:(NSString *)updateBundlePath applicationBundlePath:(nullable NSString *)applicationBundlePath updatePermission:(nullable SUUpdatePermission *)updatePermission deferInstallation:(BOOL)deferInstallation interactiveInstallation:(BOOL)interactiveInstallation verbose:(BOOL)verbose
{
self = [super init];
if (self != nil) {
@@ -46,6 +48,7 @@
}
_verbose = verbose;
_interactive = interactiveInstallation;
_applicationBundlePath = applicationBundle.bundlePath;
@@ -57,7 +60,9 @@
- (BOOL)updaterShouldInheritInstallPrivileges:(SUUpdater *)__unused updater
{
return YES;
// If the installation is interactive, we can show an authorization prompt for requesting additional privileges,
// otherwise we should have the installer inherit the updater's privileges.
return !self.interactive;
}
// In case we find an update during probing, otherwise we leave this to the user driver