munki / munki-pkg

Repo for the munkipkg tool and example projects
Other
343 stars 75 forks source link

Calling sh in payload folder from postinstall.sh #49

Closed pbm-jfields closed 2 years ago

pbm-jfields commented 3 years ago

I am trying to install Rapid7 using this project but I am running into some issues. All config files must be in the same folder as the Rapid7 agent_installer.sh script so I wrote postinstall.sh to call the agent_installer.sh script but it does not appear to be working. I have tried both full path and the relative path in the postinstall.sh script but have been unsuccessful. Any ideas on how to get this to work?

homebysix commented 3 years ago

I do something like this for an app I deploy. Here's how the MunkiPkg project folder looks:

./FooApp
├── README.md
├── build
│   └── FooApp-10.6.5.pkg
├── build-info.yaml
├── payload
│   └── private
│       └── tmp
│           └── FooApp
│               ├── FooApp.conf
│               └── installer.sh
└── scripts
    └── postinstall

And here's the postinstall, abridged:

#!/bin/bash
sh "$3/private/tmp/FooApp/installer.sh"

Note that package preinstall/postinstall scripts should not have a .sh extension. Whether other scripts have an extension or not is up to you.