views:

157

answers:

1

Hi all. I'm developing an "installation" like cocoa application wich needs to take care of some http request, some file system reading, copying files to /usr/share, set up cron (not launchd) and ask some information to user. I discarded PackageMaker since I need more flexibility.

Currently everything is going well, but on my last installation step, I need to:

  • Delete my previously installed application folder (if exists). It's always the same path: /usr/share/MY_APP
  • Create again the application folder at: /usr/share/MY_APP
  • Copy application files to /usr/share/MY_APP
  • Update a cron job

It's very important that /usr/share/MY_APP keeps protected with administrative privileges, so a regular shouldn't delete it.

What would be the best approach to implement those steps?

BTW, I'm using Xcode 3.2.

Thanks a lot! Carlos.

+2  A: 

Between the preflight script, the postflight script, and perhaps an Installer plug-in for the custom UI, I see no reason why you can't do all of this in PackageMaker.

Note: “Installer plug-in” is a little misleading. The user does not have to install the plug-in somewhere as a separate step; you include the plug-in inside your package, and Installer will use it from there.

The relevant document is a ReadMe file in a sample code project. There's also an Installer plug-in project template in Xcode since 2.0.

Also, an Installer plug-in won't get used if the user does a command-line installation. Of course, they can't install from the command line at all (which includes remote installation onto an office or lab full of machines) if you write your own custom installer.

By the way: Why /usr/share? What are you putting there? There may be a better way to do what you're really trying to accomplish.

Peter Hosey
The reason to install in /usr/share is because the application is a cross OS one (http://preyproject.com) and its first distribution came from linux. Besides, it doesn't have user interface since it's basically a cron job wich checks a URL with a given frequency, and in case it have to, run a lot of bash instructions. Cocoa application is needed to properly -- and in a fancy and friendly way -- configure the core application, and requires re-use previous configurations (in case exists), do some POST and GET to a restful http service, and implement some logic.Thank you again!
cyaconi
cyaconi: As I noted, you should be able to do the same thing in an Installer plug-in.
Peter Hosey
Peter, I'll give it a try. Thank you!
cyaconi