lindegroup/autopkgr — pull request #86 by eahrold (2014-07-29 22:27:37+00:00)
Title: Schedule Controlled via Helper tool

I've done a quick stub out of a helper tool for autopkgr that currently will handle scheduling, but can be expanded fairly easily to handle anything that needs to be done in a root context, such as the "downloadAndInstallAutoPkg" method

It uses NSXPC for the ipc, and a static library I've written called AHLaunchCtl to do the scheduling.

It dose require a valid Developer ID, the this commit has autopkgr and the helper setup to use the wildcard one, I understand this could be a deal breaker if you don't have one to with which to build official release of AutoPkgr.

I know there is a lot of code I'm submitting here, which will require quite a bit of review, but think that using a helper agent will greatly benefit the future development of AutoPkgr

I would love to participate in the development of this project. But if you're not interested in taking it in this direction please let me know. However if you are interestesd, but would like the code less buggy I'll keep working on this, I just want to make initial contact before putting too many hours in.

Right now the helper tool is installing during launch, due
to the fact that it's called, when the "Check for new versions of apps..." check box is toggled on, which happens at launch

most of the code I'm submitting are new classes, however there are some notable changes to existing code.

* the main.m now doubles as a cli tool. If you exec this it will do a run in the background...

/Applications/AutoPkgr.app/Contents/MacOS/AutoPkgr -runInBackground YES

_this is essentially what is what is called by launchd_

* There were a few class modification needed so e-mailing notices were given time to complete when running as cli tool since the mail operation was non-blocking.

* to LGMailer I've added

@property BOOL complete

* and to LGAutoPkgRunner added

@property (strong,nonatomic) LGMailer *emailer

* the startAutoPkgRunTimer method now call the helpertool to both add and remove the launchd by sending a remoteObjectProxy request over the LGAutoPkgrHelperConnection object.

####there are 3 files created on the filesystem as a result of this, and should be removed if you want to completely uninstall.

1. /Library/LaunchDaemons/com.lindegroup.AutoPkgr.schedule.plist
2. /Library/LaunchDaemons/com.lindegroup.AutoPkgr.helper.plist
3. /Library/PrivilegedHelperTools/com.lindegroup.AutoPkgr.helper

Like I said, I would love to help out with this project and humbly submit this pull request for you consideration. please feel free to contact me direclty with questions or ideas thepulsingeye@gmail.com, I'll put up a binary release of autopkgr on my github page, if you just want to see how it's working.