1

And googling hasn't helped much, I'm trying to find some example shell scripts to help me figure-out an installer.pkg pre- / post-install scripts I've been ordered to build. I have very little knowledge of shell scripting and need to find something to work with. This project was not my choice, but was dropped into my lap and I'm stuck doing it. The app could be a drag and drop affair but my manager wants an installer.pkg, no, if, ands, or buts.

Anyway, I have no clue as to where to begin. I am most experienced in applescripting, not shell scripting. If someone could point me in the right direction I would appreciate it.

Edit:

• I need to import user saved "info" from any old versions.

• If the app was never installed, I have to put the app icon in the Dock (using emmett).

• How do I get the path to the installer at run-time so as to refer to path to emmett?

  • Edited to include more specific questions. – rogerFernand Dec 1 '13 at 21:48
5

What's the task you're trying to accomplish? If you can provide requirements, it should make it easier to point you towards relevant examples.

For example, if you want to remove an existing copy of your application before installing the new one, you could use a preinstall script like this:

#!/bin/sh

# Remove existing copy of YourApplication.app from /Applications

if [[ -d "$3/Applications/YourApplication.app" ]]; then
   rm -rf "$3/Applications/YourApplication.app"
fi

The drive value is defined as "$3" because some information is passed along by the installer to its included scripts when those scripts are run by the installation process. (For more information, see the PackageMaker How-To available here and search on the page for $3)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .