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

Similar Threads
thread Thread Starter Forum Replies Last Post
OS X: Minecraft doesn't run well on my 15" 2012 MBP gretschdrummer Mac and PC Games 2 Jan 5, 2014 11:42 AM
Need help on PackageMaker knb Mac Programming 0 Jun 9, 2013 12:03 AM
addsysuser, appletfile.props & postflight files? psymas Mac Basics and Help 0 Mar 22, 2013 04:21 PM
Why doesn't iOS allow multiple apps to run 2010madone Alternatives to iOS and iOS Devices 102 Dec 9, 2012 11:44 PM
10.6: Startup Item doesn't run, only on scheduled restarts adamfishercox OS X 5 Jun 4, 2012 02:40 PM

Forum Jump

All times are GMT -5. The time now is 10:08 AM.

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

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