• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Option to execute a command?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Option to execute a command?


  • Subject: Re: Option to execute a command?
  • From: Per Olofsson <email@hidden>
  • Date: Wed, 30 Mar 2011 07:14:55 +0000
  • Thread-topic: Option to execute a command?

29 mar 2011 kl. 20:51 skrev Nathan Sims:

> I'm just starting out with PackageMaker 3.0 (OSX 10.6.7), and by using the (outdated) Apple documentation I have been able to build a package, but I need to run a command before and after the installation to tell launchctl to first unload any existing version of the app, then afterwards to load the newly installed version.
>
> In the Actions tab for the distribution, I see "Preinstall Actions" and "Postinstall Actions", but I don't see the option to execute a command anywhere. How does one do this?


What you want is preinstall and postinstall scripts. Quick walkthrough:

> Start by creating a folder named Scripts, and inside create two bash scripts:
>
> preinstall:
>
>>   #!/bin/bash
>>
>>   LAUNCHD=/Library/LaunchDaemons/edu.caltech.autonomy.foo.plist
>>   if [ -e "$LAUNCHD" ]; then
>>       launchctl unload -w "$LAUNCHD"
>>   fi
>
> postinstall:
>
>>   #!/bin/bash
>>
>>   launchctl load -w /Library/LaunchDaemons/edu.caltech.autonomy.foo.plist
>>
>
> Then chmod +x preinstall postinstall.
>
> Now in your packagemaker project, expand the component choice that you wish to add scripts for under Contents (NB: not the Distribution), and select the sub-package. Switch to the Scripts tab, and select the folder you created as the Scripts directory (leave Preinstall and Postinstall blank). Save and build.

--
Per Olofsson
System Administrator, ITS, University of Gothenburg

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Installer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Option to execute a command?
      • From: Nathan Sims <email@hidden>
References: 
 >Option to execute a command? (From: Nathan Sims <email@hidden>)

  • Prev by Date: Re: Option to execute a command?
  • Next by Date: Re: Option to execute a command?
  • Previous by thread: Re: Option to execute a command?
  • Next by thread: Re: Option to execute a command?
  • Index(es):
    • Date
    • Thread