• 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
ruby postflight script CONFIRMED
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ruby postflight script CONFIRMED


  • Subject: ruby postflight script CONFIRMED
  • From: Bill Coderre <email@hidden>
  • Date: Fri, 4 May 2007 12:42:23 -0700

I have proven to my own satisfaction that on 10.4.9 with the Developer tools installed, a ruby program can be used as a postflight script. I made an installer that does nothing special (installs a copy of SimpleText to /) and added a postflight script as follows:

Here's the script file

Attachment: postflight
Description: Binary data



Here's the contents of the script file:
#!/usr/bin/ruby

puts "Hello world! My arguments are #{ARGV}!"

The file is placed at this location Foo.pkg/Contents/Resources/postflight

Note that the file has NO extension. The Finder will sometimes trick you about this, so check 
ls -al Foo.pkg/Contents/Resources/postflight
which produces:
-rwxrwxr-x   1 root  admin  63 May  4 12:07 Foo.pkg/Contents/Resources/postflight*

Note the owner and permissions are important. That "x" bit must be there! 

Note there's no special reason you shouldn't just do the following every time you build your installer:
chmod 755 Foo.pkg/Contents/Resources/postflight
chown root:admin Foo.pkg/Contents/Resources/postflight

And here's the log showing it executed:
....
May  4 12:23:53 bcPie-apple-com : run postflight script for Foo
May  4 12:23:53 bcPie-apple-com : postflight[545]: Hello world! My arguments are /Users/bc/Desktop/Foo.pkg///!
May  4 12:23:53 bcPie-apple-com : postflight[545]:
May  4 12:23:53 bcPie-apple-com : Removing temporary directory "/private/tmp/Foo.pkg.533CO936j"
....

OK, so ruby doesn't do the prettiest job echoing the command line arguments, but there they are.

Note that my lunchtime isn't long enough to try older versions of 10.x. I also don't know the history of ruby on Mac OS X. If you are intending to ship your installer on old versions of Mac OS X, you'd best find out. If there's no ruby on the user's system, your script won't run very well.


 _______________________________________________
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

  • Prev by Date: Re: need help on my first install script
  • Next by Date: Re: postflight script failed [SOLVED]
  • Previous by thread: Re: need help on my first install script
  • Next by thread: Vise X and Archives
  • Index(es):
    • Date
    • Thread