Using Sparkle for a Kext/Framework

Asked by Anatol Pomozov

Hi,

I am working on a reference implementation of FUSE API (filesystem in userspace) http://fuse4x.org

Fuse4X consists of several pieces:
 - Kernel extension
 - dynamic libraries + header files
 - sshfs console application
 - Objective-C Framework

I want some autoupdater mechnism for it. Is there any examples of using Sparkle for kext/Framework?

Question information

Language:
English Edit question
Status:
Answered
For:
Sparkle Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Anatol Pomozov (anatol) said :
#1

Just to clarify the question:

https://github.com/andymatuschak/Sparkle/wiki/Bundles page says "you should instantiate the SUUpdater instance for your bundle in code at an early stage, just after your bundle was loaded."

I am new to macosx development and it is not clear for me how it works for Framewoks that live in /Library/Frameworks. Should add add the logic into its initializer? http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPFrameworks/Tasks/InitializingFrameworks.html#//apple_ref/doc/uid/20002259-BDEIDDJG

From other side I want to keep the Framework and update logic separately. I need it because the Framework may be used by some other package managers that do not need the autoupdater (macports), so autoupdater should be optional.

Revision history for this message
Anatol Pomozov (anatol) said :
#2

As a resume: I need sparkle for a piece of software that does not have any UI. I have 2 ideas:

1) Add a console 'autoupdater' application that uses Sparkle. This application will be periodically invoked by launchd.
2) Add a prefpane, the only goal of it is to run a Sparkle process.

I prefer 1st option, do you have any examples that implement it?

Revision history for this message
Anatol Pomozov (anatol) said :
#3

Ok, I almost managed to implement (1) but I need some help from you.

Here is the snippet that invokes Sparkle

#define FUSE4X_SUPPORT_BUNDLE_PATH "/System/Library/Filesystems/fuse4x.fs"

int main(void)
{
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

    NSBundle* fuse4xBundle = [NSBundle bundleWithPath: @FUSE4X_SUPPORT_BUNDLE_PATH];
    SUUpdater* updater = [SUUpdater updaterForBundle: fuse4xBundle];
    NSURL* feed = [NSURL URLWithString: @"http://fuse4x.org/updates/appcast.xml"];
    [updater setFeedURL: feed];
    [updater checkForUpdatesInBackground];

    [pool release];
    return 0;
}

I expect that checkForUpdatesInBackground will contact my server, but it does not happen. Do you have any idea why?

The full sourcecode you can find here https://github.com/fuse4x/support/blob/master/AutoUpdater.m

Revision history for this message
Andy Matuschak (andymatuschak) said :
#4

checkForUpdatesInBackground checks for updates in the background, i.e. asynchronously. The method returns immediately, and then your app will quit. You'll need to spin up the main runloop and run it until the update procedure is done (you can KVO-observe the updateInProgress property of your updater).

Can you help with this problem?

Provide an answer of your own, or ask Anatol Pomozov for more information if necessary.

To post a message you must log in.