How to create a Package, which runs a shell script?

While searching for a good (better) solution for this Solution, I try to solve my problem with Packages, but with no success.

My concrete problem looks simple:

  1. Copy a file to /tmp (it's an configuration script)
  2. Execute the following command:

    sudo installer -allowUntrusted -pkg "esets_remote_install.pkg" -target /
    

So there are some (or a lot of questions):

  1. To solve this problem, have I chose Distribution or Raw Package?
  2. On a Raw Package (which also could included in distribution, I can choose Require admin password for installation, if this is checked, do I still need sudo before install?

My first try was to add the pkg and the file for temp to Distribution Additional Resources in Requirement & Resources and run the script via Requirement. Did not work. My second try was to put it into the Raw Package Payloadand run the script via Pre-installation. Again, no success. Even adding the package and the configuration to Additional Resources seems not solve my problem.

Thank you very much for all solutions and ideas. Even a console solution via pkgutilis welcome.


Could you do this with Platypus? I use it to package small executables with a shell script into an install app, which uses the shell script to move executables into the target folder on run. You're still going to have issues with your intended result however as I can't see any way around running a package install without requiring admin access IF the package normally modifies files that require admin permission, but you should be able to put the package, the configuration file, and the install script together into one app using Platypus. End users can then run the app to install the package with your desired configuration.

The setup is really simple, the output is minimal. This is not a program designed to do anything complicated but it is free and has been really useful for distributing self-written script-based apps.