Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Aug 30, 2010, 05:28 PM   #1
macdong
macrumors 6502
 
Join Date: Mar 2003
Location: Seattle, WA
Send a message via ICQ to macdong Send a message via Yahoo to macdong
PackageMaker Postflight Doesn't Run

I have a package that installs an application and a plist for launch daemon. The installation works just fine, but the preflight/postflight scripts won't run. The script are named preflight and postflight, executable bit is set, just don't know what I missed. I am using PackageMaker 3.0.4 under OS X 10.6. The postflight script is as below:

#!/bin/sh
/bin/launchctl load /Library/LaunchDaemons/com.mycompany.myapp.plist
exit 0

Thanks for any help.
__________________
If Microsoft is the future, we are history.
macdong is offline   0 Reply With Quote
Old Aug 30, 2010, 05:39 PM   #2
chown33
macrumors 603
 
Join Date: Aug 2009
Obvious question: How do you know the postflight doesn't run?
That is, what is your evidence that it doesn't run, as distinct from it running but failing within the shell script itself?

Have you tried a diagnostic postflight (or preflight) script, such as:
Code:
#!/bin/bash
echo "$@"
exit 0
chown33 is offline   0 Reply With Quote
Old Aug 30, 2010, 05:40 PM   #3
macdong
Thread Starter
macrumors 6502
 
Join Date: Mar 2003
Location: Seattle, WA
Send a message via ICQ to macdong Send a message via Yahoo to macdong
Quote:
Originally Posted by chown33 View Post
Obvious question: How do you know the postflight doesn't run?
That is, what is your evidence that it doesn't run, as distinct from running but failing within the shell script itself?
Well, i've verified that the script actually runs fine from Terminal, and I was watching the console for any log my app generates, and there is nothing. But you are right, I should put an echo in there to see if it's getting called and failed or not getting called at all.
__________________
If Microsoft is the future, we are history.
macdong is offline   0 Reply With Quote
Old Aug 30, 2010, 05:45 PM   #4
macdong
Thread Starter
macrumors 6502
 
Join Date: Mar 2003
Location: Seattle, WA
Send a message via ICQ to macdong Send a message via Yahoo to macdong
Quote:
Originally Posted by chown33 View Post
Obvious question: How do you know the postflight doesn't run?
That is, what is your evidence that it doesn't run, as distinct from it running but failing within the shell script itself?

Have you tried a diagnostic postflight (or preflight) script, such as:
Code:
#!/bin/bash
echo "$@"
exit 0
Thanks for pointing out the obvious, the script does get called. But my problem still remains, if a different one. Why does the script work in Terminal, but not as a postflight script? It's a straight forward one-liner.
__________________
If Microsoft is the future, we are history.
macdong is offline   0 Reply With Quote
Old Aug 30, 2010, 06:09 PM   #5
chown33
macrumors 603
 
Join Date: Aug 2009
Quote:
Originally Posted by macdong View Post
Thanks for pointing out the obvious, the script does get called. But my problem still remains, if a different one. Why does the script work in Terminal, but not as a postflight script? It's a straight forward one-liner.
Once again, how do you know it doesn't work? What is your evidence?

Does launchctl return a failure exit status? Is the launchd job notably absent when you check for it afterwards?

What userid are you running the postflight script under? If it's root, then launchctl will target the init process (pid 1), not the current user's login process. If it's not root, then non-root users can't start or stop shared daemons.

If you're checking with launchctl, what userid is it running as?
chown33 is offline   0 Reply With Quote
Old Aug 31, 2010, 10:01 AM   #6
Guiyon
macrumors 6502a
 
Join Date: Mar 2008
Location: North Shore, MA
Is is a bundle-style package or a flat package? IIRC, Apple limits the autorun scripts to 'preinstall' and 'postinstall' in a flat package.
__________________
Make life easier if you have a programming question!
http://www.sscce.org/
Guiyon is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Run Script with Administrative Privileges during PackageMaker Installation rebello95 Mac Programming 0 Nov 7, 2011 11:27 PM
What *doesn't* run via BootCamp? hakr OS X 13 Mar 25, 2009 09:54 PM
The iPhone doesn't run Windows... mcdj iPhone Accessories 12 Jul 12, 2007 03:14 PM
Aperture doesn't run on a MacBook? Caitlyn Buying Tips and Advice 7 Aug 3, 2006 06:59 PM
First cocoa app doesn't run on other machines. typecase Mac Programming 4 Aug 8, 2005 05:17 AM


All times are GMT -5. The time now is 02:18 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC