Files
Sparkle/Autoupdate/main.m
T
Zorg 646ed6f3c4 Improve logic for allowing installer interaction
We now distinguish between the updater delegate allowing interaction and the update driver allowing interaction. We also remove an interaction allowed flag from the AppInstaller, letting shouldShowUI flag suffice.
2016-07-26 20:00:56 -04:00

32 lines
1019 B
Objective-C

#import <Foundation/Foundation.h>
#import "AppInstaller.h"
int main(int __unused argc, const char __unused *argv[])
{
@autoreleasepool
{
NSArray<NSString *> *args = [[NSProcessInfo processInfo] arguments];
if (args.count != 2) {
return EXIT_FAILURE;
}
NSString *hostBundleIdentifier = args[1];
AppInstaller *appInstaller = [[AppInstaller alloc] initWithHostBundleIdentifier:hostBundleIdentifier];
[appInstaller start];
// Ignore SIGTERM because we are going to catch it ourselves
signal(SIGTERM, SIG_IGN);
dispatch_source_t sigtermSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGTERM, 0, dispatch_get_main_queue());
dispatch_source_set_event_handler(sigtermSource, ^{
[appInstaller cleanupAndExitWithStatus:SIGTERM];
});
dispatch_resume(sigtermSource);
[[NSRunLoop currentRunLoop] run];
}
return EXIT_SUCCESS;
}